下拉菜单和显示隐藏的元素的 Z 索引问题

发布于 2024-09-16 16:15:49 字数 469 浏览 5 评论 0原文

我刚刚将 superfish 添加到 我的页面。但是下拉菜单显示在 我的 header-bottom div 下,其中已显示:隐藏。但这并不是唯一的问题 由我的 Easy Slider 其中有图像和 div,但我无法分辨哪一个覆盖了我的下拉菜单。

我不太熟悉使用 z-index 解决这个问题的最佳方法是什么?

I just added superfish to my page. But the drop down menu displays under my header-bottom div which has display: hidden. But that's not the only problem it is also
covered by my Easy Slider which has images and divs and I can't tell which one is covering my drop down menu.

I'm not very familiar using z-index
What's the best way of solving this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瑾夏年华 2024-09-23 16:15:49

检查包含菜单的容器是否具有相对位置。 Z-index 仅适用于位置属性为“相对”或“绝对”的元素。

例如:

<div style="position:relative">Menu here</div>

Check that container, which contains your menu has relative position. Z-index works only for elements, which has position attribute 'relative' of 'absolute'.

For example:

<div style="position:relative">Menu here</div>
七分※倦醒 2024-09-23 16:15:49

通过 CSS 在两个元素上添加 z-index 属性。 (菜单)和(滑块)

<div style="z-index:2;">Menu</div>

<div style="z-index:1;">Slider (or whatever coming after the menu)</div>

是的,原因是使用两个带有 position:relative; 的元素

Add z-index property on both elements through CSS. (menu) and (slider)

<div style="z-index:2;">Menu</div>

<div style="z-index:1;">Slider (or whatever coming after the menu)</div>

and yes, the reason is using two elements with the position:relative;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文