CSS Pseudo-elements
Decorative content
.required::after {
content: " *";
color: #dc2626;
}
blockquote::before {
content: "“";
font-size: 2rem;
}
Pseudo-elements can add decorative content, but essential information should remain in the HTML.
Text styling
p::first-letter { font-size: 1.5em; font-weight: 700; }
::selection { background: #bfdbfe; color: #172554; }
Practice
Add a decorative label to a heading using ::after.
Want to learn this professionally?
Explore practical IT training at Cyber Code Academy.
View Academy Courses