如何在导航栏上下移动时更改其背景颜色?我更改了bootstrap.css的一些部分:
.navbar{
background-color: #A9B7C0;
border-bottom-color: #EFD9C1;
}
.navbar-inverse {
background-color: #A9B7C0 !important;
}
.container .navHeaderCollapse .nav li a {
color: #EFD9C1;
}
.container .navHeaderCollapse .nav .dropdown .dropdown-menu li a {
color: black;
}
.navbar .navbar-brand{
color: #EFD9C1;
}
.navbar .navbar-brand:hover{
color: #EAC67A;
}
.collapse .nav .active a{
color: #A9B7C0 !important;
background-color:#EFD9C1;
}
.collapse .nav .active a:hover{
background-color:#EFD9C1;
color: #A9B7C0;
}
body {
background-color: #CCCBC6;
color:white;
}
@media screen and (max-width: 375px) {
.fullName{
display:none;
}
}
当向下折叠或返回压缩模式的操作仍在进行时,背景色保持黑色,我希望它是我定制的引导程序的颜色。一旦它完成折叠,它就会变成我设置的背景色。
下面是我的html代码:
<div class="navbar navbar-inverse navbar-static-top">
<div class ="container">
<div class="navbar-header">
<a href="http://www.facebook.com/rayvenhatesyou" class="navbar-brand"> <span class="glyphicon glyphicon-user"></span> <span class="fullName">Rayven Yor Zambo Esplanada</span></a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="(1)Home.html">Home</a></li>
<li><a href="(2)AboutMe.html">About Me</a></li>
<li class="dropdown">
<a href="(3)MyFamily.html" class="dropdown-toggle" data-toggle = "dropdown">My Family <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#"> Mother </a></li>
<li><a href="#"> Father </a></li>
<li><a href="#"> Younger Brother </a></li>
<li><a href="#"> Older Brother </a></li>
</ul>
</li>
<li><a href="(4)Contact.html">Contact Me</a></li>
</ul>
</div>
</div>
</div>
1条答案
按热度按时间63lcw9qa1#
您需要使用与bootstrap相同的选择器,即:
.navbar-inverse .navbar-nav>.active>a
这就是你的风格如何覆盖引导程序的风格。http://jsbin.com/weguya/edit?html,css,output