i'm trying to create a menubar with rounded corners, but when i add the float:left to the li elements, the rounded corners dissapear...
This is my code:
<ul>
<li>jkfasdf</li>
<li>jkfasdf</li>
<li>jkfasdf</li>
</ul>
ul{
background: red;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 5px;
}
li {
padding: 5px;
#float: left; #toggle this
}
add overflow:hidden to ul's css:
ul{
background: red;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
overflow:hidden;
}
Currently, when you add a float:left; ul became 0px height. That why it looks like rounded corners disappear.
overflow:hidden is one of the fixes for such issues. See demo here: http://jsfiddle.net/2x3Vm/
If all you want to do is show your LI's next to eachother, display: inline-block; might actually work better than floating the elements.
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