← All Quizzes
What are CSS pseudo-elements and how are they used?
Explanation
CSS pseudo-elements style specific parts of an element or generate virtual elements. Common pseudo-elements include ::before and ::after (generate content before/after an element, requiring content property), ::first-line and ::first-letter (style the first line/letter of text), and ::selection (style selected text). Pseudo-elements use double-colon syntax (::) to distinguish from pseudo-classes. They are widely used for decorative elements, icons, tooltips, and clearfix techniques.