| Welcome to WebmasterWorld Guest from 22.214.171.124 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Centering using text-align|
| 1:35 am on Sep 7, 2009 (gmt 0)|
How do I center a single div block using text-align: center? I need it for IE5. I can't get it to work putting it on "body".
I've read it here many times.
What's on the page is a lone DIV width 500px.
(margin: 0 auto on the div works fine)
| 3:22 am on Sep 7, 2009 (gmt 0)|
I'm guessing text-align: center doesn't work in later browsers. Margin: 0 auto on the div is necessary?
| 3:46 am on Sep 7, 2009 (gmt 0)|
The standard way to center horizontally is auto margins and a given width on block element such as a div.
IE5: that's so ancient it might indeed need what IE6 needs in quirks mode: text-align: center on the parent. I've long since no more copy of IE5 (nor visitors still using it) ...
A standards compliant browser should not center a block if it's parent has text-align:center (that's only for centering inline elements)
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved