html部分:
<li class="{% if page.author %}current{% endif %}">
<a href="/news/">People</a>
<div class="popup">
<a href="#">Presenter</a>
<div class="popup1">
<a href="#">AAA</a>
</div>
<a href="#">Staff</a>
<div class="popup1">
<a href="#">StaffA</a>
</div>
<a href="#">Student</a>
</div>
</li>
scss部分:
li {
display: inline-block;
&:hover .popup{
display: block;
&:hover .popup1{
display: block;
}
&:hover .popup1{
display: block;
}
}
}
.popup
{
display:none;
text-align:left;
position:absolute;
z-index:9999;
width:30em;
background-color: #333;
padding: 0.0em;
}
.popup1
{
display:none;
text-align:left;
position:absolute;
z-index:9999;
width:30em;
background-color: #333;
padding: 0.0em;
}
正常结果应该是在presenter下面是AAA,staff下面是staffA。但实际上是presenter下面是staffA,把AAA给覆盖起来了还不对。
不知道为什么问题被踩了,之前有个朋友回答了下但是又给删了,之前有些忙没有及时回复,你说的貌似是有关于class属性层次的问题?css那里面的括号层次不是很明显,但是我也注意了层次之间也没有问题啊也注意到了嵌套的问题,但是我认为这句还是有些不对,,求大家指教啊!
&:hover .popup1{
display: block;
}
&:hover .popup1{
display: block;
}
}
I had solved problems after I looked up to the website: line25.com/tutorials/how-to-create-a-pure-css-dropdown-menu which Tim answered. The website is great and just solved what I asked . Thanks a lot!
I used ">" attribute in css to solve my problem and some of my origin code were wrong.
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。