CSS Pseudo-elements
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
Here are the list of CSS pseudo elements
| Selector | Example | Example description |
|---|---|---|
| ::after | p::after | Insert something after the content of each element |
| ::before | p::before | Insert something before the content of each element |
| ::first-letter | p::first-letter | Selects the first letter of each element |
| ::first-line | p::first-line | Selects the first line of each element |
| ::marker | ::marker | Selects the markers of list items |
| ::selection | p::selection | Selects the portion of an element that is selected by a user |
example,
See the Pen pseudo elements by Arpit (@soniarpit) on CodePen.
Previous: CSS Pseudo Class