我正在尝试创建一个下拉列表。我不确定代码有什么问题。当我将鼠标悬停在每个列表元素上时,它不会将整个宽度标记为红色。 here is the preview
这是我的HTML:
<!-- Navigation -->
<nav class="navbar navbar-custom">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a class="navbar-menu" href="#">Deals</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle navbar-menu-title" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
这是我的CSS:
.navbar-custom {
background-color: #128C7E;
border-radius: 0px;
}
.navbar-custom a {
color: #ffffff;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-image: none !important;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: red;
}