Ok, so I am trying to center a div with dynamic content (both its width and height are unknown because the text takes up unknown space and wraps an unknown amount of lines).
Per this post, I managed to center the div horizontally.
However when I apply the same principle to vertical centering, the block only moves 50% down (and doesn’t move up at all).
JSFiddle of my problem here: http://jsfiddle.net/nMqJG/2/ ; as you can see, it is centered horizontally but not vertically…
Thanks and any help appreciated,
If you don’t need to support old browsers, use
display: table-cell. Details hereHTML:
CSS:
Fiddle: http://jsfiddle.net/nMqJG/25/