What does the double colon (::) mean in CSS?

前端 未结 3 1562
深忆病人
深忆病人 2020-11-29 21:46

What does the double colon (::) mean in CSS?

For example:

input[type=text]::-ms-clear { display: none; }
3条回答
  •  被撕碎了的回忆
    2020-11-29 22:42

    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.

    Source

    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.

提交回复
热议问题