Forum Moderators: not2easy

Message Too Old, No Replies

Best method to vertical align a DIV inside a DIV?

         

foxfox

2:32 pm on Mar 21, 2007 (gmt 0)

10+ Year Member



After searching in Google, i found serveral method? such as using a very large line-height.

I found that most of them are hacky, i.e. seems might break in the next version of browsers very easily.

So any recommended or preferred method in dealing with vertical aligning?

Thanks.

thesheep

2:51 pm on Mar 21, 2007 (gmt 0)

10+ Year Member



Well there is a clever method you can use that involves using a negative top margin that is half the height of the inner (vertically centered) element. I've found that to be reliable across browsers, except for IEMac.

I don't think line-height will help you.