From the course: Mastering Web Developer Interview Code

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

What's the difference between a pseudo-class and a pseudo-element?

What's the difference between a pseudo-class and a pseudo-element?

From the course: Mastering Web Developer Interview Code

What's the difference between a pseudo-class and a pseudo-element?

- [Tutor] This week we're going to talk about the difference between pseudo classes versus pseudo elements. And this is a question that you may get on some interviews. It really tests the knowledge that you have of CSS, and it's a bit tricky because it's about a very subtle difference. Although you've probably use both pseudo classes and elements, you probably haven't thought much about how they differ. So let's go ahead and dig in. Now, pseudo class is a way of selecting an existing HTML element. Now that's really important because that's the main difference between a pseudo class and a pseudo element. It selects that element based on either a state or a property of the elements. So we'll take a look at some examples in just a second. Now, pseudo classes are related to an existing element using a single colon character. Some common pseudo classes are hover, which lets you modify an element when you hover over it,…

Contents