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...
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...
css伪元素用于向某些选择器设置特殊效果, 伪元素的语法; 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; }...
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-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 ...
相同点:两者均以selector或者selector.class的形式开头。 不同点:pseudo-class的操作对象是文档树中已有的元素,而pseudo-element则创建了一个文档数外的元素。 pseudo-class只有一个冒号,pseudo-element有两个冒号 2.CSS的color设置与调色板 color:有多种表示方法 ...
CSS 伪元素 (Pseudo-elements)CSS 伪元素用于向某些选择器设置特殊效果。语法 伪元素的语法: selector:pseudo-element {property:value;} CSS 类也可以与伪元素配合使用: selector.class:pseudo-element {property:value;}:first-line 伪元素 "first-line" 伪元素用于向文本的首行设置特殊样式。 在下面的例子中,...
The ::first-line pseudo-element puts a style on a first line in a block-level container. It does not select inline-level elements, such as images or inline-tables.Some CSS properties can be used to style the ::first-line, they are:font properties...
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...
The :first-child selector allows you to target the first element immediately inside another element. It is defined in the CSS […] Continue Reading :first-of-type The :first-of-type selector in CSS allows you to target the first occurence of an element within its container. It is […]...