双冒号(::)是什么意思在CSS? [英] What does the double colon (::) mean in CSS?
问题描述
在CSS中,双冒号( ::
)是什么意思?
What does the double colon (::
) mean in CSS?
例如:
input[type=text]::-ms-clear { display: none; }
推荐答案
>选择器。这意味着右侧的元素在正常DOM中不存在,但可以选择。
It means pseudo element selector. It means the element to the right doesn't exist in the normal DOM, but can be selected.
伪元素由两个冒号(:)和后面的伪元素的名称组成。
A pseudo-element is made of two colons (::) followed by the name of the pseudo-element.
它最初只有一个冒号,但已更改为区分它与伪类(如:hover
,:first-child
,:not
等)。最好使用: for
之前的
和之后的
伪元素因为单冒号具有更好的浏览器支持,即在早期的IE版本中。
It was originally only a single colon, but was changed to differentiate it from pseudo classes (like :hover
, :first-child
, :not
etc). It's best to use :
for before
and after
pseudo elements since the single colon has better browser support, namely in earlier IE versions.
这篇关于双冒号(::)是什么意思在CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!