I have a bottom border of a ul. There's bottom border of links inside the list items also. I want to adjust the position of the link border so that it is exactly on the ul border, so that it looks like this:
I am unable to set the border position. Here's my code:
HTML:
<ul>
<li><a href="#" class="active">item 1</a></li>
<li><a href="#">item 2</a></li>
<li><a href="#">item 3</a></li>
</ul>
CSS:
ul{
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
margin-bottom: 5px;
padding-bottom: 5px;
border-bottom: 1px solid green;
}
ul li{
float: left;
margin-right: 10px;
}
ul li a{
text-decoration: none;
display: block;
}
ul li a.active{
border-bottom: 5px solid red;
}
JSFiddle: http://jsfiddle.net/sZ8Gu/
Don't know if this will be option for you, but removing overflow and giving height to ul does the job. jsfiddle
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