Selectors by pseudo-elements.
Pseudo-elements.
These selectors refer to elements that are not necessarily delimited by HTML tags. For example, the pseudo-element ::first-letter refers to the
first letter of the text of an element, even though no HTML tag delimits this first letter.
Do not confuse pseudo-elements and pseudo-classes. The distinction is as follows:
- Pseudo-classes refer to a state of an element, for example, a link that has already been visited, an element hovered over by the mouse, etc.
- Pseudo-elements target a part of an element. For example,
::first-linerefers to the first line of text of the element.
The names of pseudo-elements start with a double colon ( :: ).
Note! Browsers generally recognize the simple colon for both pseudo-classes and pseudo-elements. This is due to the fact that previous versions of CSS
did not differentiate between pseudo-classes and pseudo-elements.
Used alone, pseudo-elements apply to all tags, but it is easy to combine them with a classic selector to limit their scope:
::first-letter targets the first letter of all elements that contain text.
h1::first-letter target the first letter of the titles h1.
CSS Overflow Module



CSS Pseudo-Elements Module




placeholder attribute).


CSS View Transitions Module




