Paul Kahl wrote:

>>Also how do I align content center with div tags. I am trying not to 
>>use any tables. All I want is my "navBar" to align center on the page.
>>It doesn't work with text-align or 
>>margin-left:auto;margin-right:auto; or align="center" in the div 
>>tag. I can center using a table but I don't wnat to use any tables.
>>    
>>
>
>There's also (in addition to the many fine examples already cited) a nifty
>way to do this with percentages that amazingly, I haven't seen in any
>response thus far:
>
>div.parent {width: 100%; text-align: center;}
>div.child {width: 80%;}
>
><div class="parent">
>       <div class="child">
>               content
>       </div>
></div>
>
>This will set the initial div at full window width, and the child will be
>centered and take up 80% of the page. Or even a pixel/em dimmension instead
>of the 80%. It's a bit of a hack, but works beautifully.
>  
>

This centers the *text* of the child div, since text-align is inherited, 
but does not center the actual child *div.*  To see this, add a 
background color to the child div.  Use the auto margins to center the div.

Only IE 5.x (and IE 6 in quirks mode) will center a div using 
text-align: center, because only they think that a div is text.

Zoe

-- 
Zoe M. Gillenwater
Design Services Manager
UNC Highway Safety Research Center
http://www.hsrc.unc.edu

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to