- Everything in this table cell div is centred
- It can dynamically change to any height based on content (try by changing your browser font size)
- Doesn’t get cut off when there isn't enough room
- Doesn’t work in Internet Explorer
- Uses 2 extra
div
s
display:table;
display:table-cell;
vertical-align:middle;
div
spositoin:absolute; top:50%; height:240px; margin-top:(negative half the height);
float:left;
height:50%;
margin-bottom:-120px;
position:relative; clear:left; height:240px;
div
(not too bad)top:0; bottom:0; left:0; right:0;
position:absolute; margin:auto;
height:something; width:something;
line-height:10em; height:10em;
By Douglas Heriot 2008
For NetTuts.com