html - 带有 z-index 的菜单下的子菜单

标签 html css z-index

我有这个菜单:http://jsfiddle.net/gywcv/

我试图将“测试”子菜单放在粉红色栏下,但没有找到解决方案。

我测试了position:relative, position:absolute 等:

header .container-fluid nav ul li div.submenu {
    height: auto;
    min-height:45px;
    border-width: 1px;
    border-color: rgb( 205, 205, 205 );
    border-style: solid;
    background-color: rgb( 255, 255, 255 );
    box-shadow: 0px 0px 5px 0px rgb( 0, 0, 0 );
    margin-top: 12px;
    position:relative;
    z-index:1;
}

最佳答案

请参阅此 fiddle :http://jsfiddle.net/bradleytrager/k8CfZ/

您必须使“测试”子菜单的位置相对,然后为顶部设置一个值:

header .container-fluid nav ul li div.submenu{
    /*display:none;*/
    height: auto;
    min-height:45px;
    border-width: 1px;
    border-color: rgb( 205, 205, 205 );
    border-style: solid;
    background-color: rgb( 255, 255, 255 );
    box-shadow: 0px 0px 5px 0px rgb( 0, 0, 0 );
    margin-top: 12px;
    color:#000000;
    position:relative;
    top:10px;
}

关于html - 带有 z-index 的菜单下的子菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20617186/

相关文章:

javascript - 其他页面的表单提交按钮

html - 在 div 中包含很长的文本

html - 固定div的CSS水平居中?

javascript - SVG 圆圈笔划上的图形伪像,仅限 IE 和 Firefox (Windows)

jquery - jqGrid 和 Wijmo WijMenu 的 z 索引问题

javascript - 在 Jhipster 应用程序中合并 2 个 Angular 页面

html - CSS 中特殊的反向级联

javascript - 在 mousemove 上翻阅图像

html - 为嵌套在固定容器内的绝对位置设置 Z-index

css - 为什么具有 z-index 值的元素不能覆盖其子元素?