why won't div center?

liunx

Guest
could someone please esplain to me why my horizontal navbar won't center

<div id="navcontainer" align="center">

#navcontainer LI
{
display: block;
text-align: center;
float: left;
margin: 0;
padding: 0;
width: auto;
}margin: 0 auto;


Edit: It's probably because you're floating it, if the above doesn't (by chance) work. Take the "float: left" off, then use the above code, and it will center.For IE, you might also have to put a wrapper div around it.


<div style="text-align:center;">
HTML here
</div>


as IE doesn't seem to support margin: auto;In what version of IE, Mr. Initial Man? (I haven't set up IE5 and IE5.5 in addition to my IE6.)I've had troubles getting it to center in IE6. I always have to put a wrapper div around it, with the text-align:center; CSS in it.
 
Back
Top