gpt4 book ai didi

html - 更改导航栏链接的颜色及其悬停

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

我正在使用 bootstrap 在网站上工作,但我无法更改链接的颜色并且它在导航栏中悬停。我想不通,我应该将颜色声明放在 CSS 中的什么位置。

HTML 代码

 <!-- Navigation -->
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
<a class="navbar-brand" href="index.html">MG STAV stavební, spol. s r.o</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="index.html">Domů</a>
</li>
<li>
<a href="about.html">O společnosti</a>
</li>
<li>
<a href="reference.html">Reference</a>
</li>
<li>
<a href="contact.html">Kontakt</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>

最佳答案

尝试为所有导航的 <a> 提供一个 ID .

<a id = "link"....>..</a>

CSS:

#link{
color:red; //any other color
}

#link:hover{
color:black; //any other color
}

工作示例:http://jsfiddle.net/joez9apm/

关于html - 更改导航栏链接的颜色及其悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28723757/

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