无法从蓝色更改导航丸默认背景颜色

时间:2016-12-09 02:27:47

标签: html css twitter-bootstrap-3

我不能为我的生活摆脱导航丸的默认蓝色背景色。在你问之前,我已经查找了类似的问题,尝试了提出的解决方案,修改了一些但似乎没有任何工作。我是HTML / CSS的新手,这可能是一个愚蠢的问题,但到底是什么。 Since I'm working with a grey background navigation bar, I'd like the tabs to have a color that'd complement it

以下是代码:

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" href="Random.css" />
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
</head>

<body>
  <nav>
    <ul class="nav nav-pills">
      <li><a href="#" target="_blank">C.O. Dev.</a>
      </li>
      <li class="pull-right"><a href="#">Contact</a>
      </li>
      <li class="pull-right"><a href="#">My Work</a>
      </li>
      <li class="pull-right"><a href="#">About</a>
      </li>
      <li class="pull-right active"><a href="#">Home</a>
      </li>
    </ul>
  </nav>
</body>

</html>

1 个答案:

答案 0 :(得分:1)

您必须使用自定义css覆盖它。 nav.less统治了主动导航的风格。创建自己的CSS并使用它:

.nav-pills>li.active>a{
 color: #337ab7 !important;
 background-color: #eee !important;
}

&#13;
&#13;
.nav-pills>li.active>a{
 color: #337ab7 !important;
 background-color: #eee !important;
}
&#13;
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" href="Random.css" />
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
</head>

<body>
  <nav>
    <ul class="nav nav-pills">
      <li><a href="#" target="_blank">C.O. Dev.</a>
      </li>
      <li class="pull-right"><a href="#">Contact</a>
      </li>
      <li class="pull-right"><a href="#">My Work</a>
      </li>
      <li class="pull-right"><a href="#">About</a>
      </li>
      <li class="pull-right active"><a href="#">Home</a>
      </li>
    </ul>
  </nav>
</body>

</html>
&#13;
&#13;
&#13;