I wrote two a:hover, but the second-level drop-down menu always uses the hover of the first-level navigation. This Why? Is my code written wrong? Asking for expert advice!
<style type="text/css">/* 一级导航 */* {margin: 0; padding: 0;}ul {list-style: none;}a {text-decoration: none;}body {margin-top: 5px;}#nav {background: #39F; widht: 100%; height: 30px; line-height: 30px;}#nav ul {float: left; position: relative; left: 50%;}#nav ul li {float: left; position: relative; right: 50%;}#nav a {display: block; width: 100px; margin: 0 5px; text-align: center;}#nav a:hover {background: #FFF; color: #F00;}/* 二级导航 */.nav_list {position:absolute; left: 0; top: 30px; width: 98px; border: 1px solid #000; background: #F60; line-height: 30px; overflow: hidden;}.nav_list a {display: block; color: #FFF; width: 100px; text-align: center; color: #F00;}.nav_list a:hover {background: #0F0; color: #00F;}</style></head><body> <div id="nav"> <ul> <li><a href="#">电影</a> <div class="nav_list"> <ul> <li><a href="#">动作片</a></li> <li><a href="#">喜剧片</a></li> <li><a href="#">科幻片</a></li> </ul> </div> </li> <li><a href="#">电视剧</a></li> <li><a href="#">综艺</a></li> </ul> </div>
#nav .nav_list {position:absolute; left: 0; top: 30px; width: 98px; border: 1px solid #000; background: #F60; line-height: 30px; overflow: hidden;}#nav .nav_list a {display: block; color: #FFF; width: 100px; text-align: center; color: #F00;}#nav .nav_list a:hover {background: #0F0; color: #00F;}
XML/HTML code?123#nav .nav_list {position:absolute; left: 0; top: 30px; width: 98px; border: 1px solid #000; background: #F60; line-height: 30px; overflow: hidden;}#nav .nav_list a {displ...
Thank you, it was solved