谁能告诉我,我该如何修复下拉菜单?有些元素是不可见的,因为菜单在两行,第二行隐藏了下拉菜单中的元素。我认为好的解决方案是使用 css 代码,但我不知道该怎么做。
最佳答案
将 z-index
和 top
属性添加到 ul.sub-menu
中,悬停时淡入淡出,
更新 - 只需按照 Praveen Kumar 作品的建议更改 z-index
。因此,如果您将 top 属性添加到 ul.sub-menu
将在某处破坏您的结构。
z-index : The z-index CSS property specifies the z-order of a positioned element and its descendants. When elements overlap, z-order determines which one covers the other. An element with a larger z-index generally covers an element with a lower one.
.navbar-inverse .navbar-nav ul.sub-menu {
display: none;
position: absolute;
top: 100%;
background: #fff;
width: 200px;
box-shadow: 3px 3px 2px rgba(50, 50, 50, 0.08);
top: 35px; /*Add this*/
z-index: 9; /*Add this*/
}
关于css - 下拉菜单中的元素不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45562757/