gpt4 book ai didi

css - 即使使用 zindex 也看不到子菜单

转载 作者:太空宇宙 更新时间:2023-11-04 04:06:32 25 4
gpt4 key购买 nike

悬停时不显示子菜单。我不确定是哪一部分出了问题。以前,我能够在 display:none 被删除时显示我的子菜单。但我希望当我将鼠标悬停在该菜单项上时显示子菜单。谢谢。

#navigation ul li a:hover { 
background-color: rgba(255, 255, 255, 0.1);
display: block;
}

#navigation ul li ul {
position: absolute;
top: 58px;
left: 0px;
width: 200px;
border: none;
z-index: 1200!important;
background: #D32828;
display: none;
}

最佳答案

如果没有看到您的 HTML 很难说,但大概您想要更改:

#navigation ul li a:hover { ... }

收件人:

#navigation ul li a:hover + ul { ... }

否则,您只是将 a 元素设置为 display: block on hover,不是 ul元素。

关于css - 即使使用 zindex 也看不到子菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21286448/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com