gpt4 book ai didi

html - 无法在悬停时更改字体颜色 - Bootstrap Navbar

转载 作者:太空宇宙 更新时间:2023-11-03 21:25:15 25 4
gpt4 key购买 nike

所以,我有一个子导航栏,它在悬停时只会改变 <li> 的颜色而不是文字。这是我的代码供您引用。我错过了什么?我敢肯定这是一件非常小的事情,我忽略了。

.section-navbar {
margin: -10px 0 0 -12px;
}

.section-navbar>ul {
margin: 0px 0 -35px 0px;
padding: 2px 0px;
background-color: #ececec;
height: 32px;
}

.section-navbar>ul>li {
display: block;
float: left;
height: 30px;
text-align: center;
background-color: #ececec;
border-right-color: #fff;
border-right-width: thin;
border-right-style: solid;
border-radius: 2px;
font-weight: normal;
font-size: 12px;
padding: 5px 20px;
}

.section-navbar>ul>li>a {
display: inline-block;
color: #999;
text-decoration: none;
}

.section-navbar>ul>li.active {
background-color: #0083ca;
border-radius: 2px;
border-top-color: #359dd5;
border-top-style: solid;
border-top-width: medium;
text-decoration: none;
padding: 7px 20px;
margin-top: -5px;
color: #fff;
font-weight:bold;
letter-spacing:0.5px;
height: 35px;
}

.section-navbar>ul>li:hover {
background-color: #0083ca;
border-radius: 2px;
border-top-color: #359dd5;
border-top-style: solid;
border-top-width: medium;
text-decoration: none;
margin: -5px 0;
height:35px;
color: #fff;
}
<div class="section-navbar">
<ul>
<li><a href="#">Search</a></li>
<li><a href="#">Option 2</a></li>
<li class="active">Lorem ipsum dolor sit</li>
<li><a href="#">Option 4</a></li>

</ul>
</div>

最佳答案

.section-navbar {
margin: -10px 0 0 -12px;
}

.section-navbar>ul {
margin: 0px 0 -35px 0px;
padding: 2px 0px;
background-color: #ececec;
height: 32px;
}

.section-navbar>ul>li {
display: block;
float: left;
height: 30px;
text-align: center;
background-color: #ececec;
border-right-color: #fff;
border-right-width: thin;
border-right-style: solid;
border-radius: 2px;
font-weight: normal;
font-size: 12px;
padding: 5px 20px;
}

.section-navbar>ul>li>a {
display: inline-block;
color: #999;
text-decoration: none;
}

.section-navbar>ul>li.active {
background-color: #0083ca;
border-radius: 2px;
border-top-color: #359dd5;
border-top-style: solid;
border-top-width: medium;
text-decoration: none;
padding: 7px 20px;
margin-top: -5px;
color: #fff;
font-weight:bold;
letter-spacing:0.5px;
height: 35px;
}

.section-navbar > ul > li:hover a {color:red}

.section-navbar>ul>li:hover {
background-color: #0083ca;
border-radius: 2px;
border-top-color: #359dd5;
border-top-style: solid;
border-top-width: medium;
text-decoration: none;
margin: -5px 0;
height:35px;
color: red!important;
}
<div class="section-navbar">
<ul>
<li><a href="#">Search</a></li>
<li><a href="#">Option 2</a></li>
<li class="active">Lorem ipsum dolor sit</li>
<li><a href="#">Option 4</a></li>

</ul>
</div>

关于html - 无法在悬停时更改字体颜色 - Bootstrap Navbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33492171/

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