Re:A div that looks different in every browser
by gedy on Sunday July 08, 2018 @09:05PM
(#17487257)
Sure, because "vertically centered" means relative to what?
[ Parent
| on HN ]
Re:A div that looks different in every browser
by Dylan16807 on Monday July 09, 2018 @08:27AM
(#17489711)
I want the contents of my div to be centered inside my div.
Just like <center> works, but vertically. You don't need <foo><bar>content</bar></foo> for horizontal centering. I consider it a layering violation to have to do that nesting.
Maybe we are misunderstanding each other, but while you don't need an "extra" container, you do need a container with some known height to vertically center the content in:
http://jsfiddle.net/c20gq4pz/