html - css 兼容性,在 chrome 中一个额外的列表项

标签 html css

我有html

<div id="leftDiv">
<ul>
    <li class="submenu_items" style="display: list-item;">
        <ul class="nomargin"> 
            <li><a href="/link1.php">One</a></li>
            <li><a href="/link2.php">Two</a></li>
        </ul>
    </li>                
</ul>
</div>

CSS 是

#leftDiv ul li.submenu_items ul.nomargin{
    margin:0;             
    list-style-image:none!important;
}

我有

#leftDiv ul li{
   list-style-image: url("/images/spacer.png");
}

在 ff 中,一切看起来都很好,但在 chrome 和 opera 中,我有来自 ul li bg(/images/spacer.png) 的额外图像,看起来我在 chrome 和 opera 中有一个额外的列表项

enter image description here enter image description here

最佳答案

查看此 Fiddle

你实际上有 3 <li>节点,您的 CSS 不能正确适应您想要的输出。

您可能希望将 CSS 更改为:

#leftDiv ul{
   list-style:none;
}
#leftDiv ul li.submenu_items ul.nomargin{
   margin:0; list-style:none!important; 
} 
#leftDiv ul ul li{ 
   list-style-image: url(/images/spacer.png); 
}

关于html - css 兼容性,在 chrome 中一个额外的列表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19977639/

相关文章:

html - Table Cell 内的 Liquid Pre

html - 溢出 :hidden is not for the divs of circle shape?

html - 输入的 Css 属性选择器在 IE8 中不起作用

css - 页脚和页面底部之间的大空间

css - Chrome 中出现带有 CSS 动画的奇怪白框?

jquery - 单击 li 时添加值顶部选择选项

javascript - iframe 不适用于通配符包罗万象的子域和 dnsmasq

css - 遇到 0 高度 div 的问题,但没有 float 。我能做些什么?

javascript - 在函数中,jQuery 选择器返回 PreviousObject 而不是所选对象

css - IE中的中心页面