CSS Selectors
Pseudo-elements
A pseudo-element styles a specific part of an element. It starts with two colons.
| Pseudo-element | Styles |
|---|---|
::before | Inserts content before the element's content |
::after | Inserts content after it |
::first-letter | The first letter |
::first-line | The first line |
::placeholder | Placeholder text of an input |
::selection | Text the user has highlighted |
.required::after { content: " *"; color: red; }
p::first-letter { font-size: 2em; font-weight: bold; }
::selection { background: gold; }
input::placeholder { color: #999; }