li ::之前的IE8

时间:2012-07-23 08:15:03

标签: javascript css internet-explorer-8 pseudo-element

我正在使用li::before删除一些内容,但此代码适用于所有浏览器,但不适用于IE8。为什么?我需要JavaScript解决方案吗?

这是我的代码:

.NewsArchive li::before, .NewsSubMenu li::before {
    content: "• ";
    display: none !important;
}

1 个答案:

答案 0 :(得分:4)

对于CSS1和CSS2伪元素,IE8不支持CSS3's double-colon notation。该表示法仅由IE9 and later和其他浏览器支持。

如果您需要IE8支持,则必须使用单冒号:

.NewsArchive li:before, .NewsSubMenu li:before {
    content: "• ";
    display: none !important;
}

不需要JavaScript。而你很可能也不需要!important