Just a quickie, i am probably being silly here but anyway:
I have a navigation that is centrally positioned with margins, this has a list of links, the problem i am having is that because all of my <li>
classes are given the css: float:left
they align on the left.
E.G:
What i would like to know is if there is any way to center these?
Thanks
CSS:
section#nav {
height: 45px;
margin-bottom:5px;
text-align:center;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
nav {
max-width: 700px;
height: 45px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
margin: 0 auto;
}
nav ul {
padding:12px 15px;
margin:0 auto;
text-align:center;
overflow:hidden;
}
nav ul li {
font-size:14px;
float:left;
}
nav ul li a {
color: #FFFFFF;
margin:0 10px;
transition: all 0.5s ease-out !important;
-moz-transition: all 0.5s ease-out !important;
-ms-transition: all 0.5s ease-out !important;
-webkit-transition: all 0.5s ease-out !important;
-o-transition: all 0.5s ease-out !important;
}
nav ul li a.nav-path-selected {
border-bottom:1px #ffffff solid;
}
nav ul li a.nav-path-selected {
border-bottom:1px #ffffff solid;
color:#FFFFFF !important;
}
nav ul li a:hover {
color:#CCCCCC !important;
transition: all 0.5s ease-out !important;
-moz-transition: all 0.5s ease-out !important;
-ms-transition: all 0.5s ease-out !important;
-webkit-transition: all 0.5s ease-out !important;
-o-transition: all 0.5s ease-out !important;
}
HTML:
<section id="nav">
<nav>
<ul class="nav">
<li class="nav-selected nav-path-selected">
<a class="nav-selected nav-path-selected" href="/">Home</a>
</li>
<li>
<a href="/about/">About Us</a>
</li>
<li>
<a href="/opportunities/">Opportunities</a>
</li>
<li>
<a href="/inspiration/">Inspiration</a>
</li>
<li>
<a href="/members/">Members</a>
</li>
</ul>
</nav>
</section>
calculate its width correctly. Or set manualy with CSS
– João Mosmann Jul 26 '12 at 22:58