How to vertically center content with variable height within a div?

Posted by jessegavin on Stack Overflow See other posts from Stack Overflow or by jessegavin
Published on 2008-09-12T15:29:55Z Indexed on 2010/05/24 23:41 UTC
Read the original article Hit count: 186

Filed under:

What is the best way to vertically center the content of a div when the height of the content is variable. In my particular case, the height of the container div is fixed, but it would be great if there were a solution that would work in cases where the container has a variable height as well. Also, I would love a solution with no, or very little use of CSS hacks and/or non-semantic markup.

alt text

© Stack Overflow or respective owner

Related posts about css