HTML & CSS · Junior · Question 34 of 75

How does a pseudo-class differ from a pseudo-element?

Explanation

A pseudo-class selects an existing element in a particular state or position. A pseudo-element creates or targets a part of an element that isn't a separate DOM node. Per CSS3, pseudo-elements use two colons (::before) and pseudo-classes one; a single colon on legacy pseudo-elements is still supported for compatibility.

Further reading

Problem with a question

HTML & CSS · Junior · question 34

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz