删除按钮上的bootstrap navbar悬停效果

时间:2016-06-22 21:17:41

标签: html css twitter-bootstrap hover navbar

我想从导航栏中的按钮中删除悬停效果我该怎么办?[在此输入图像说明] [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>

3 个答案:

答案 0 :(得分:5)

添加此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>

答案 1 :(得分:2)

a:hover {
 display: none;
}

这将删除悬停时的所有内容,但是如果你想让它看起来像没有悬停在那里,你可以设置a:hover具有与原始颜色相同的背景颜色。例如。

答案 2 :(得分:2)

.navbar-default .navbar-nav li a:hover, .navbar-default .navbar-nav > .active > a:hover, { background-color: initial; }

这只会消除悬停效果,而不是活动效果