在导航栏中更改颜色

时间:2016-09-30 11:29:42

标签: html css

我正在尝试更改脚本导航栏中参数“hover”的颜色。

在css文件“colors”中我看到了:

.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus {
    background-color: #e1e1e1;
}

改变“焦点”的效果很好但是如果我尝试以这种方式改变“悬停”,那就什么都没有:

.navbar-inverse .navbar-nav > .active > a;
.navbar-inverse .navbar-nav > .active > a:hover {
    background-color: #e1e1e1;
}

.navbar-inverse .navbar-nav > .active > a:focus {
    background-color: #e1e1e1;
}

其他选项包括:

.navbar-inverse {
    background-color: #ffffff;
}

.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus {
    color: #fff;
}

.navbar-inverse .navbar-nav > li > a {
  color: #ababab;
}

.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
  color: #ffffff;
}

.navbar-inverse .navbar-toggle {
    border-color: transparent;
    background-color: rgba(255,255,255,0.05);
}

.navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus {
    background-color: rgba(255,255,255,0.1);
}

建议?

2 个答案:

答案 0 :(得分:0)

您可以在这些订单中放置这些特定的伪选择器:

  1. a:link
  2. a:visited
  3. a:hover
  4. a:active
  5. a:focus *
  6. * :focus不在本系列AFAIK中,但为了以防万一,请将其放在最后。

    
    
    body {
      background-color: black;
    }
    .navbar-inverse .navbar-nav > .active > a,
    .navbar-inverse .navbar-nav > .active > a:link,
    .navbar-inverse .navbar-nav > .active > a:visited {
      background-color: #e1e1e1;
      color: blue;
      font: 400 40px/1.5 Verdana;
      text-decoration: none;
      padding:5px 10px;
    }
    .navbar-inverse .navbar-nav > .active > a:hover,
    .navbar-inverse .navbar-nav > .active > a:active,
    .navbar-inverse .navbar-nav > .active > a:focus {
      background-color: #b00b12;
      color: cyan;
    }
    
    <nav class='navbar-inverse'>
     <nav class='navbar-nav'>
      <div class='active'>
        <a href='#/https://pron.069'>Adult Videos</a>
      </div>
     </nav>
    </nav>
    &#13;
    &#13;
    &#13;

答案 1 :(得分:0)

改变;代替那种用途,

.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover {
    background-color: #e1e1e1;
}

.navbar-inverse .navbar-nav > .active > a:focus {
    background-color: #e1e1e1;
}