homepage Welcome to WebmasterWorld Guest from 184.73.40.21
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Centering using text-align
jessejump

5+ Year Member



 
Msg#: 3985288 posted 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)

 

jessejump

5+ Year Member



 
Msg#: 3985288 posted 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?

swa66

WebmasterWorld Senior Member swa66 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3985288 posted 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)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved