[英]li:hover doesn't get triggered
I haven't done this in a long time and I looked it up aswell but when I hover over an li I expect its child UL to open up (display), but it isn't: 我已经很长时间没有这样做了,我也向上看了一下,但是当我将鼠标悬停在li上时,我希望它的子UL打开(显示),但事实并非如此:
<nav>
<ul>
<li><a href="#">Products <img src="~/Shared/Assets/Images/LIItemArrow.png" /></a>
<ul>
<li>Hi</li>
</ul>
</li>
<li><a href="#">Services <img src="~/Shared/Assets/Images/LIItemArrow.png" /></a></li>
<li><a href="#">Shop <img src="~/Shared/Assets/Images/LIItemArrow.png" /></a></li>
</ul>
</nav>
CSS: CSS:
ul li ul { display: none; }
ul li:hover > ul {
display: block;
}
According to the several articles I looked up, I believe that I'm doing this right, so why won't this work? 根据我查阅的几篇文章,我相信我做的不错,那为什么不行呢?
Add height: auto, so your code would become 增加高度:自动,因此您的代码将变为
ul li ul { display: none; }
ul li:hover > ul {
display: block;
height: auto;
}
I had similar problems while I was creating menu. 创建菜单时遇到类似的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.