Are CSS3 ::before and ::after pseudo elements supported by IE9 or not?(IE9 是否支持 CSS3 ::before 和 ::after 伪元素?)
问题描述
关于这个 MS 兼容性表 它说,IE9 不支持伪元素 ::before
和 ::after
,但是当我尝试它时,它似乎确实...见 JSBin
On this MS compatibility table it says, IE9 does not support pseudo-elements ::before
and ::after
, but when I try it seems it does... see JSBin
我做错了吗?我认为 ::before
和 ::after
会是很好的工具来隐藏 IE9 中的内容,而事实上它们并没有.
Am I doing something wrong? I thought ::before
and ::after
would be nice tools to hide stuff from IE9, when in fact, they don't.
推荐答案
CSS2伪元素:before
和:after
,采用传统的单冒号,受 IE8 及更高版本支持.它们对 CSS3 并不陌生.
The CSS2 pseudo-elements :before
and :after
, with the traditional single-colon notation, are supported by IE8 and later. They are not new to CSS3.
另一方面,双冒号表示法是 CSS3 的新内容.IE9 确实支持 ::before
和 ::after
,对于 CSS1 伪元素 ::first-line
和 ::first-letter
.然而,今后不会有新的伪元素使用单冒号语法,并且浏览器(包括 IE)应该支持所有伪元素的双冒号语法.
The double-colon notation, on the other hand, is new to CSS3. IE9 does support this new notation for ::before
and ::after
, and likewise for the CSS1 pseudo-elements ::first-line
and ::first-letter
. Going forward, however, no new pseudo-element may use the single colon syntax, and browsers (including IE) are expected to support the double colon syntax for all pseudo-elements.
我不知道为什么该表说 IE9 不支持新的伪元素语法,因为根据上面链接的各个选择器的文档和您的测试用例,它确实支持.当然,还有这个答案.
I have no clue why that table says IE9 doesn't support the new pseudo-element syntax, because it certainly does according to the docs for the individual selectors linked above, and your test case. As well as, of course, this answer.
这篇关于IE9 是否支持 CSS3 ::before 和 ::after 伪元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!