gpt4 book ai didi

html - 调整边框位置

转载 作者:搜寻专家 更新时间:2023-10-31 22:03:07 25 4
gpt4 key购买 nike

我有一个 ul 的底部边框。列表项内也有链接的底部边框。我想调整链接边框的位置,让它正好在ul边框上,这样看起来是这样的:

enter image description here

我无法设置边框位置。这是我的代码:

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/

最佳答案

不知道这是否适合您,但是删除 overflow 并将高度赋予 ul 就可以了。 jsfiddle

关于html - 调整边框位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16649137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com