|
Vertical Centering in IEJeffrey P. Bigham |
|
Related Ads |
Why is it that CSS makes everything so incredibly difficult? All I wanted to do was vertically center a div in another div. I wanted it to work like the valign attribute td elements in HTML tables, but noooo... Firefox (and probably other standard-compliant browsers) make this easy, if not at all intuitive. For these browsers, you can tell the browser to treat your div element like a table element and then you can tell it to vertical-align center and all is good. This works like so:
But, for some reason, IE doesn't do this, so you have to hack it in. The #foo is a hack that IE will interpret but Firefox (and other browsers) will ignore. This then becomes:
|
|
|
||