html - li 列表定位行为

标签 html css

http://jsfiddle.net/chapster11/aUYTt/

我想弄清楚为什么这个 jsfiddle 示例中的第三级 ul 标记列表被压扁在与第二级 ul 相同的位置 第二级 li 标签定位正确,但第三级搞砸了任何想法为什么。 position absolute 是否会破坏默认的列表层级定位?

谢谢

最佳答案

因为

#nav ul{
    position:absolute;
}

这对所有 <ul> 都很重要里面#nav , 所以即使在第三或第五级。

单独重新设计第三层的样式:

#nav ul ul {
    position: static;
}

另请参阅:http://reference.sitepoint.com/css/position

关于html - li 列表定位行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6721234/

相关文章:

php - Wordpress 仅在主页中缩小 html

html - 在单选按钮文本附近没有对齐。它有点提升

javascript - Javascript 中的 array_chunk 和 For 循环,用于在一个 div 中附加多个元素

css - HTML div 与下面的 div 重叠内容。 HTML CSS 初学者

JAVASCRIPT 设置 utterscroll 的步骤?

html - 只有嵌套在 anchor 中的 div 的上半部分是可点击的

jquery - rails/CSS : How do I make a gallery of images of different widths?

html - Excel 样式 2d 可滚动网格,在 CSS 中带有水平和垂直标签

html - Bootstrap - 将保存行上的 2 个图像与大小自适应对齐

css - 截断 float 框中的文本并在悬停时完整显示