.required::after {
content: " *";
color: red;
}Tip
Know the distinction: pseudo-CLASS targets a state (:hover), pseudo-ELEMENT creates a virtual sub-element (::before).
GoCareerGo Tutorials
Selectors, box model, Flexbox, Grid, animation and responsive design.
::before and ::after inject generated content into an element without adding extra HTML markup.
.required::after {
content: " *";
color: red;
}Know the distinction: pseudo-CLASS targets a state (:hover), pseudo-ELEMENT creates a virtual sub-element (::before).