[thelist] CSS centering in IE
Gary McPherson
lists at ingenyus.net
Wed Jan 28 15:58:17 CST 2004
Rob Day wrote:
>In the CSS comments (http://www.pfundernewmedia.com/shawn/styles-site.css) there's a mention of a CSS hack, but I can't figure out what's going on.
>
>
Sorry, missed that bit the first time round. The hack works around IE's
lack of support for the margin:auto property. In compliant browsers,
this will horizontally centre that element within it's parent as the
margins are automatically calculated and given the same values. Part 1
sets the text-align of the parent element (in this case, body) to
center, so that all child elements now sit in the middle of it. However,
this will affect all descendant elements including any text, so Part 2
resets the text-align of the centered element to left to restore the
alignment of all it's descendants.
Hope that helps,
Gary
More information about the thelist
mailing list