我使用带有.sf-menu类的超级鱼菜单来做菜单。我希望将ul li悬停在li之前保留一定的背景颜色。我的菜单代码是:
<ul class="sf-menu" id="example">
<li class="current">
<a href="followed.html">Home</a>
</li>
<li>
<a href="followed.html">Knives</a>
<ul>
<li><a href="followed.html">Cardsharp4 natural</a></li>
<li><a href="followed.html">Cardsharp4 black</a></li>
<li><a href="followed.html">Cardsharp3 natural</a></li>
<li><a href="followed.html">Cardsharp2 black</a></li>
<li><a href="followed.html">Cardsharp2 natural</a></li>
</ul>
</li>
<li>
<a href="followed.html">Flashlights</a>
<ul>
<li><a href="followed.html">Flashlight 1</a></li>
<li><a href="followed.html">Flashlight 1</a></li>
<li><a href="followed.html">Flashlight 1</a></li>
<li><a href="followed.html">Flashlight 1</a></li>
</ul>
</li>
<li>
<a href="followed.html">Camera</a>
</li>
<li>
<a href="followed.html">E-Bike</a>
</li>
</ul>
我尝试过4种不同的选择器,似乎没有选择:S
.sf-menu ul li > .sf-menu li {background-color: #ffffff;}
.sf-menu ul li > li a {background-color: #ffffff;}
.sf-menu ul ul li:hover.active ul li a {background-color: #ffffff;}
.sf-menu ul li ul li:hover.active ul li {background-color: #ffffff;}
任何人都可以建议自己。
三江源