CSS Pseudo-elements
Last updated
Last updated
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:
p::after
Insert something after the content of each <p> element
div.redDiv::before
Insert something before the content of each <div class='redDiv'>
element
.someClass::first-letter
Selects the first letter of each element haing classsomeClass
p::first-line
Selects the first line of each <p> element
::marker
Selects the markers of list items
p::selection
Selects the portion of an element that is selected by a user