【问题标题】:Dropdown menu, z-index problems下拉菜单,z-index 问题
【发布时间】:2013-05-01 12:50:08
【问题描述】:

我有一个问题。我有一个下拉菜单,但下拉列表总是在 body 后面一层,尽管 menu 的 z-index 设置为 999 并且 body 的 z index 设置为 -999

请检查http://www.w3dominik.com/x/finemoney/(右上角的菜单,它显示下拉菜单,应该有2个选项,现在只有1个可见)

感谢您的帮助

【问题讨论】:

  • 您的网站容易发生变化。请更新此问题以包含代码和小提琴。

标签: html css z-index layer


【解决方案1】:

这将为您解决问题:

#header_wrap {
  position: relative;
  z-index: 10;
}

您通常需要在最外层的父级上设置 z-index(尤其是在旧版本的 IE 中)。

【讨论】:

  • “你经常需要在最外层的父节点上设置 z-index”这帮助我找到了有问题的 z-index,谢谢!
  • 旧帖子,但我又错过了一些东西。我正在更改子元素,但从未想过要设置父元素。谢谢。
【解决方案2】:

只需添加position: relative,没有位置z-index 将不起作用。

header ul {
    display: inline-block;
    float: right;
    height: 30px;
    z-index: 999;
    position: relative;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-19
    • 1970-01-01
    • 1970-01-01
    • 2011-10-21
    • 1970-01-01
    • 2023-04-10
    • 2012-12-04
    • 1970-01-01
    相关资源
    最近更新 更多