Question

The navigation menu is not centered. I have tried many methods of getting it to be centered, but none worked.

HTML

<div id="nav-bar">
<li> <a href="index.html">Home</a> </li>    
<li> <a href="servicii.html">Servicii</a> </li>    
<li> <a href="portofoliu.html">Portofoliu</a> </li>    
<li> <a href="contact.html">Contact</a> </li>

CSS

#nav-bar li a {
color: #000;
text-decoration: none;
list-style-type: none;
font-size: 14px;
font-family: "Myriad Pro", "Myriad Pro Cond", "Myriad Pro Light", Arial, sans-serif;
font-weight: bold;

#nav-bar {
text-transform: uppercase;
list-style: none;
padding: 23px 0 23px 0;
background-image: url(../images/nav-bar.jpg);

#nav-bar li {
float: left;
margin-right: 58px;
margin-left: 58px;
margin-top: -8px;
}   
Was it helpful?

Solution

http://jsfiddle.net/NLfaz/4/

#nav-bar {
   text-align: center;
}

#nav-bar li {
   float: left;  /* removed this line */
   display: inline-block;
}

Also, you weren't closing some of your css with } , so I added those in

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top