DOCTYPE html>p::first-line{color:#ff0000;font-variant:small-caps;}You can use the ::first-line pseudo-element to add a special effect to the first line of a text. Some more text. And even more, and more, and more, and more, and more, and more, and more, and more, and more,...
The single-colon syntax was used for both pseudo-classes and pseudo-elements in CSS2 and CSS1. For backward compatibility, the single-colon syntax is acceptable for CSS2 and CSS1 pseudo-elements. The ::first-letter Pseudo-element The::first-letterpseudo-element is used to add a special styl...
This is used to matches the portion of an element that is selected by a user then apply the CSS rule in the selected content. background properties color properties cursor properties outline properties Ex: – p::selection { background-color: red; } ::before- This is used to insert somethi...
The ::before and ::after pseudo-elements can be used to insert generated content either before or after an element's content. The content CSS property is used in conjunction with these pseudo-elements, to insert the generated content.
CSS 之pseudo-classes 与pseudo-element的异同 从W3School找到相关资料如下: 伪类: 伪类存在的意义是为了通过选择器找到那些不存在与DOM树中的信息以及不能被常规CSS选择器获取到的信息。 伪类由一个冒号:开头,冒号后面是伪类的名称和包含在圆括号中的可选参数。
CSS - The ::selection Pseudo-element When a user selects a portion of an element , the::selectionpseudo-element is matched. CSS properties can be applied to::selection, includingcolor,background,cursor, andoutline. The code snippet below demonstrates how to apply red color to the selected te...
A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s).
CSS - The ::selection Pseudo-element The::selectionpseudo-element matches the portion of an element that is selected by a user. The following CSS properties can be applied to::selection:color,background,cursor, andoutline. The following example makes the selected text red on a yellow backgroun...
s technical definition, a pseudo-class is basically a phantom state or specific characteristic of an element that can be targeted with CSS. A few common pseudo-classes are:link,:visited,:hover,:active,:first-childand:nth-child. There are more, and we’re going to see them all in a ...
css05 CSS Pseudo-classes What are Pseudo-classes? A pseudo-class is used to define a special state of an element. For example, it can be used to: Style an element when a user mouses over it Style visited and unvisited links differently...