gpt4 book ai didi

html - 导航栏 - 高度/间距问题

转载 作者:太空宇宙 更新时间:2023-11-04 05:21:53 26 4
gpt4 key购买 nike

我想让导航栏看起来像这样:

enter image description here

我无法让它正常工作,如何解决?

<ul class="subnav">
<li> <a href=""> Text One</a></li>
<li> <a href=""> Text Two</a></li>
<li> <a class="active" href=""> Text Three</a></li>
<li> <a href=""> Text Four</a></li>
</ul>

<style>
.subnav {
list-style:none;
border-bottom:1px solid #c7c4ba;
}
.subnav li{
display:inline;
font-size:14px;
margin-right:1px;
}
.subnav a:hover {
background-color:white;
color:black;
}

.subnav a {
background-color:#c7c4ba;
color:white;
text-decoration: none;
}

.subnav .active {
background-color:white;
color:#c61c25;
border:1px solid #c7c4ba;
}
</style>

最佳答案

这对你有用吗? http://jsfiddle.net/ypZqK/1/您想要的效果已经有了,但我不知道您还希望如何显示不同的事件。

CSS:

.subnav {
list-style:none;
border-bottom:1px solid #c7c4ba;
float:left;
}
.subnav li{
display:inline;
font-size:14px;
margin-right:1px;
float: left;
width: 100px;
height: 25px;
text-align: center;
border:1px solid #c7c4ba;
border-bottom: 0;
line-height: 25px;
background-color:#c7c4ba;
}
.subnav li:first-child{
margin-left: 25px;
}
.subnav a:hover {
background-color:white;
color:black;
}

.subnav a {
color:white;
text-decoration: none;
}

.subnav li.active {
background-color:white;
z-index:999;
}

.subnav li.active a{
color:#c61c25;
}
.clearBorder {
position: relative;
width: 100px;
bottom: 0;
background-color: white;
float: left;
height: 1px;
}

HTML:

<ul class="subnav">
<li> <a href=""> Text One</a></li>
<li> <a href=""> Text Two</a></li>
<li class="active"> <a href=""> Text Three <span class="clearBorder"</span></a></li>
<li> <a href=""> Text Four</a></li>
</ul>

关于html - 导航栏 - 高度/间距问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6362931/

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