2 ms·
Your example does not align vertically, so I am not sure what you are trying to prove. This CSS will put something in the center of your screen quite easily
by protonfish 12y ago
Your example does not align vertically, so I am not sure what you are trying to prove. This CSS will put something in the center of your screen quite easily
position: absolute; top: 50%; left: 50%;
Is that so hard? Having poor CSS skills is not the same as CSS being broken.
- cyphax 12y agoUnfortunately, that's telling your div to start halfway. Following your suggestion leaves me with an element with its top left corner in the exact center of the containing div. I'm not a fan of CSS due to issues like this. It falls in the same line as issues where, for example, paddings and margins (and borders) are added to the size of your div rather than subtracted. There's a solution for that that makes sense nowadays but by the time that came about, I'd already stopped liking CSS.