I have a list and some problems. I can't centralize < li >, they are always aligned. Here's an example of how they are:

Now, as I'm trying to let them:

Could anyone help me solve this problem please? Here the code I'm using.
HTML
<div class="header_middle_menu">
<ul>
<li><a href="#">A</a></li>
<li><a href="#">B</a></li>
<li><a href="#">C</a></li>
<li><a href="#">D</a></li>
<li><a href="#">E</a></li>
<li><a href="#">F</a></li>
<li><a href="#">G</a></li>
<li><a href="#">H</a></li>
</ul>
</div>
CSS
.header_middle_menu{
float: left;
margin-left: 50px;
margin-top: 15px;
width: 490px;
}
.header_middle_menu li{
float: left;
}
.header_middle_menu ul{
list-style: none;
}
.header_middle_menu ul li{
background: #FB5904;
display: inline;
margin: 5px;
padding: 7px;
}
.header_middle_menu ul li a{
color: #FFFFFF;
font-family: arial;
font-size: 13px;
text-decoration: none;
}
.header_middle_menu li:hover ul{
display: block;
}
You can do these three things:
text-align:center; to .header_middle_menufloat: left; from .header_middle_menu lidisplay: inline; to display: inline-block; in .header_middle_menu ul lijsFiddle example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With