css伪类选择器
In contrast to standard CSS selectors, pseudo selectors allow you to alter the appearance of a state or fragment of an element. They are divided into pseudo class selectors and pseudo element selectors.
与标准CSS选择器相比 , 伪选择器允许您更改状态或元素片段的外观 。 它们分为伪类选择器和伪元素选择器 。
Pseudo-class selectors describe the state of an element, such as
:hover
or:empty
. On a style sheet, they are preceded by a single colon.伪类选择器描述元素的状态 ,例如
:hover
或:empty
。 在样式表上,它们前面是单个冒号。As their name suggests pseudo-element selectors control the presentation of a portion of content, such as the first line or letter of a paragraph. Formally, they are preceded by a double colon (
::
), although a single colon will work in most cases.顾名思义, 伪元素选择器控制部分内容的表示 ,例如段落的第一行或字母。 正式地,它们前面有一个双冒号(
::
,尽管在大多数情况下一个冒号也可以。
Pseudo selectors are distinguished by the fact that they must be written in an embedded, linked or scoped style sheet: they cannot be written inline.
伪选择器的特征在于它们必须以嵌入式,链接的或作用域的样式表编写:它们不能内联编写。
This list is not yet exhaustive: pseudo-class selectors such as ::hover
are used extensively in tutorials on this site, but do not yet have their own individual articles. As soon as that changes, they will be added here.
该列表尚未穷尽:该站点的教程中广泛使用了伪类选择器(如::hover
,但还没有自己的文章。 更改后,将在此处添加它们。
翻译自: https://thenewcode.com/176/Web-Developer-Reading-List-CSS-Pseudo-Class-Selectors
css伪类选择器