PDA

View Full Version : How to center my Nav Bar



Snot
06-19-2008, 01:27 AM
This is the html part of my code and it may be the problem.


<div id="navblock">
<ul id="mainNav">
<li><a href="../../index.php" title="Tarantula Database Home">Home</a></li>
<li><a href="../pages/search.php" title="Tarantula Database Search">Search</a></li>
<li><a href="../pages/submit.php" title="Tarantula Database Submit">Submit</a></li>
<li><a href="index.php" title="Tarantula Database Forum">Forum</a></li>
<li><a href="../pages/contact.php" title="Tarantula Database Contact">Contact</a></li>
</ul>
</div>


With the css code it was floating to the left and looked fine but it wan't centered. it look like like this

http://www.tarantuladatabase.com/this1.JPG

So I changed my css code to this


}

ul#mainNav li{
border-top: 1px solid #766454;
border-bottom: 1px solid #766454;
margin-right: auto;
margin-left: auto;
}

And that didnt work either

http://www.tarantuladatabase.com/assets/forum

Any idea how I can center it?

allahverdi
06-19-2008, 04:09 AM
Can u insert here what css was here before?

thetestingsite
06-19-2008, 04:15 AM
Try:



#navblock {
margin: 0 auto;
}


Hope this helps.

boogyman
06-19-2008, 12:17 PM
Try:



#navblock {
margin: 0 auto;
}


Hope this helps.

you need to either include a width: property or a text-align:center; in order for the above code to work properly across all browsers.



#navblock {
margin: 0 auto;
width: 80%;
}