双冒号(::)是什么意思在CSS? [英] What does the double colon (::) mean in CSS?

查看:250
本文介绍了双冒号(::)是什么意思在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆