The point is to have a single line on this menu, wrapped.
Instead, we are getting “two lines” and I’m not getting why is he dropping the line.
Can anyone please drop me a quick look about how is this happening ?
The HTML
<div id="main-menu">
<ul>
<li><a href="">item 1</a></li>
<li><a href="">item 2</a></li>
<li><a href="">item 3</a></li>
</ul>
</div>
CSS
#main-menu {
clear: right;
overflow: hidden;
margin-top: 75px;
float:right;
}
#main-menu ul {
overflow: hidden;
text-align: right;
border-radius: 5px;
background-color: #333;
}
#main-menu ul li {
display:inline-block;
padding: 2px 2%;
}
#main-menu ul li a {
color: #fff;
font-size: .9em;
}
#main-menu ul li:hover {
background-color: #EFAB00;
}
#main-menu ul li a:hover {
text-decoration: none;
}
Here an example:
This isn’t caused by the
float, it’s because of the padding you’re applying to yourlis (because when you have percentagepaddings, the parent doesn’t resize-to-fit). If you change yourpadding: 2px 2%;topadding: 2px;the wrapping will be gone: little link.Hope that helped!