Vertical centering in CSS

Centering a block of text (or anything else) vertically within a div has been a longstanding problem where tables seem to have the advantage.

I recently came across this article about vertical centering and tried using the bottommost code snippet today with good results in FF, IE6, Opera and Netscape. It’s a bit clumsy, but it does the trick there – however this doesn’t work in IE7.

I wound up using the topmost snippet – with hacks, which I don’t like using, but I was pressed for time this morning… I’m going to revisit this when I have an opportunity to see if I can figure out what to do about IE7 and the non-hacked example.

Leave a Reply

Your email address will not be published. Required fields are marked *