我一直在尝试在导航栏中的下拉菜单中编辑悬停时的背景颜色,但它仍然保持这种灰色。我在下面发布了一些我试图调整的代码以及HTML代码。
.dropdown-menu {
background-image: transparent !important;
background-color:#285eff !important;
color:#668CFF !important;
border: 1px solid #668CFF !important;
}
.dropdown-menu > li > a {
background-image: transparent !important;
color: #D2DCFC !important;
}
.dropdown-toggle:active,
.dropdown-toggle:focus,
.dropdown:active,
.dropdown > .open {
background-image: transparent !important;
background-color:#2658ED !important;
}
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus,
.dropdown-menu>li>a:active,
.dropdown-submenu:hover > a{
background-image: transparent !important;
background-color: #2658ED !important;
}
.dropdown-menu li.active > a,
.dropdown-menu li.active > a:hover,
.dropdown-menu li.active > a:focus {
background-image: transparent !important;
background-color: #2658ED !important;
}
ul.nav li ul {
background-color:#2658ED !important;
}
<div class="navbar navbar-final navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<a href="#" class="navbar-brand">CleverPlay</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="#">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Games <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="yahtzee/index.php">Yahtzee</a></li>
<li><a href="hangman/index.php">Hangman</a></li>
<li><a href="flapcard/index.php">Flapcard</a></li>
</ul>
</li>
<li><a href="#">Scores</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</div>
此外,我还有一个问题,每当我从窗口取消选择网页所在的另一个网页(而不是标签),然后它将背景颜色变为灰色,但文本仍然很好。
答案 0 :(得分:0)
对于问题的上半部分,请添加以下内容:
.dropdown-menu > li > a {
background-image:none; // before setting any background-color
}