CSS 新手。我有一个导航菜单栏,当您将鼠标悬停在“组合”下的下拉菜单中时,我试图填充背景颜色(蓝色)。有任何想法吗?我想是因为那个绝对?
CSS:
#nav, #nav ul {
float: left;
list-style: none;
box-shadow: 0px 1px 7px #000000;
background-color: #F5F1DE;
border-radius: 5px 5px 0px 0px;
z-index: 100;
}
#nav li a {
display: block;
padding: 16px;
text-decoration: none;
font-weight: bold;
color: black;
border-left: 1px solid #ccc;
font-size: 1em;
}
#nav li a:hover {
color: black;
background-color: #bbecff;
}
#nav li {
float: left;
}
#nav li ul {
position: absolute;
width: 11em;
left: -999em;
border-radius: 1px;
}
#nav li:hover ul, #nav li.sfhover ul {
left: auto;
}
HTML:
<ul id="nav">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Packages</a></li>
<li><a href="#">Portfolio</a>
<ul>
<li><a href="#">Weddings</a></li>
<li><a href="#">Special Events</a></li>
<li><a href="#">Holidays</a></li>
<li><a href="#">Fresh Flowers</a></li>
<li><a href="#">Balloon Sculptures</a></li>
</ul>
</li>
<li><a href="#">Contact</a></li>
</ul>