CSS
CSS Pseudo-ElementsCSS Pseudo-Elements
CSS pseudo-elements style specific parts of an element.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
CSS pseudo-elements target sub-sections of an HTML element without needing extra tags. Developers use them to style just the first letter of a paragraph or inject decorative icons before a heading. They use a double colon syntax.
Syntax
Syntax
Example
Example
Key Points
- Pseudo-elements target partial element contents.
- The `::first-letter` creates drop caps.
- The `::before` injects visual content before the element.
- The `::after` injects visual content after the element.