[英]css pseudo selector not working on div
Im trying to create a fixed menu on the side of my page. 我试图在页面的侧面创建一个固定菜单。 However, I want it partially hidden and to expand on hover only.
但是,我希望它部分隐藏并且仅在悬停时扩展。 I tried to do this with css and pseudo selectors but it won't work.
我试图用css和伪选择器来做到这一点,但这是行不通的。
HTML: HTML:
<div id="sideMenu">
<ul>
<li>Wide Screen</li> <!--turn sidebar on/off-->
<li>Random Border</li> <!--randomize vidcontain border-->
<li>Control Bar</li>
</ul>
</div>
CSS: CSS:
#sideMenu{
position: fixed;
left: -95px;
top: 250px;
height:100px;
width:100px;
background-color: #D4D048;
z-index:-1;
display:block;
}
#sideMenu:hover{
left: 0px;
}
Z-index on the div prevented the div from recognizing it was being hovered and therefore the rules pertaining to hover were not applied. div上的Z索引使div无法识别它已被悬停,因此不适用与悬停有关的规则。 Increasing the z-index position solved this issue.
增加z-index位置解决了此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.