A CSS pseudo-element is used to style specified parts of an element. For example, it can be used to: Style the first letter, or line, of an element Insert content before, or after, the content of an element Syntax The syntax of pseudo-elements: selector::pseudo-element{ property: valu...
A CSS pseudo-class is a keyword added to selectors that specifies a special state of the element to be selected. For example :hover will apply a style when the user hovers over the element specified by the selector. 我觉得 pseudo class 叫 state selector pseudo elements 叫 sub-elements sel...
selector::pseudo-element{ property:value; } The ::first-line Pseudo-element The::first-linepseudo-element is used to add a special style to the first line of a text. The following example formats the first line of the text in all <p> elements: ...
A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s).
CSS - Max Inline Size CSS - Min Inline Size CSS - Offset CSS - Accent Color CSS - User Select CSS - Cascading CSS - Universal Selectors CSS - ID Selectors CSS - Group Selectors CSS - Class Selectors CSS - Child Selectors CSS - Element Selectors CSS - Descendant Selectors CSS - General...
CSS 伪元素 (Pseudo-elements)CSS 伪元素用于向某些选择器设置特殊效果。语法 伪元素的语法: selector:pseudo-element {property:value;} CSS 类也可以与伪元素配合使用: selector.class:pseudo-element {property:value;}:first-line 伪元素 "first-line" 伪元素用于向文本的首行设置特殊样式。 在下面的例子中,...
相同点:两者均以selector或者selector.class的形式开头。 不同点:pseudo-class的操作对象是文档树中已有的元素,而pseudo-element则创建了一个文档数外的元素。 pseudo-class只有一个冒号,pseudo-element有两个冒号 2.CSS的color设置与调色板 color:有多种表示方法 ...
Only a few CSS properties can be used to style the ::selection pseudo-element: color background-color text-shadow cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color The -moz- prefix is used with this selector in the form ::-moz-se...
This is used to style specified parts of an element. Syntax: – selector::pseudo-element { property:value; } Ex: – p::first-letter { color: red; } ::first-letter ::first-line ::selection ::before ::after ::first-letter- This is used to add a style to the first letter of the...
selector:pseduo-element{property:value;} css类也可以与伪元素配合使用: select.class:pseudo-element{property:value;} :first-line伪元素, "first-line"伪元素用于向文本的首行设置特殊样式, p:first-line{ color:#ff0000; font-variant:small-caps; ...