2012-07-23 40 views
1

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

这是我的代码:

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

你使用jQuery或其他JS框架? – 2012-07-23 08:17:07

+0

应该工作:http://www.quirksmode.org/css/beforeafter_content.html ie> 7 – rsplak 2012-07-23 08:17:39

回答

4

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

如果您需要IE8的支持,你必须使用一个冒号:

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

无需JavaScript的。而且你很可能不需要!important