Question 8 of 10Pro Only

What is the difference between pseudo-classes and pseudo-elements in CSS?

Sample answer preview

Pseudo-classes and pseudo-elements extend CSS selectors but serve different purposes. Pseudo-classes select elements based on state or position. They use a single colon. Common examples include :hover for mouse over, :focus for focused inputs, :first-child and :last-child for…

pseudo-classpseudo-element:hover::before::aftercontent

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Frontend Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime