twitter-bootstrap 删除按钮上的引导导航栏悬停效果
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37978404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
remove bootstrap navbar hover effect on button
提问by Amir Torkashvand
I want to remove the hover effect from my button in navbar how can i do that?[enter image description here][1]
我想从导航栏中的按钮中删除悬停效果,我该怎么做?[在此处输入图片描述][1]
<nav class="navbar navbar transparent">
<div class="container-fluid logo ">
<div class="navbar-header ">
<a class="navbar-brand " href="#">
<img src="images/Logo.png" />
</a>
</div>
<ul class="nav navbar-nav navbar-right right">
<li>
<a href="#">Get free trial</a>
</li>
<li class="Buybtn-topright">
<a href="#">Buy now</a>
</li>
</ul>
</div>
</nav>
回答by Roman Skydan
Add this css
添加这个css
.nav>li>a:focus, .nav>li>a:hover {
text-decoration: none;
background-color: transparent !important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar transparent">
<div class="container-fluid logo ">
<div class="navbar-header ">
<a class="navbar-brand " href="#">
<img src="images/Logo.png" />
</a>
</div>
<ul class="nav navbar-nav navbar-right right">
<li>
<a href="#">Get free trial</a>
</li>
<li class="Buybtn-topright">
<a href="#">Buy now</a>
</li>
</ul>
</div>
</nav>
回答by skanthala
.navbar-default .navbar-nav li a:hover,
.navbar-default .navbar-nav > .active > a:hover, {
background-color: initial;
}
.navbar-default .navbar-nav li a:hover,
.navbar-default .navbar-nav > .active > a:hover, {
background-color: initial;
}
this would only remove the hover effect,not the active effect
这只会删除悬停效果,而不是主动效果
回答by matmik
a:hover {
display: none;
}
That is going to remove everything on hover, but if you want to just make it look like theres no hover there, you can set the a:hover have background-color same as the original one is. For example.
这将删除悬停时的所有内容,但如果您只想让它看起来没有悬停,您可以将 a:hover 设置为与原始背景颜色相同。例如。

