课程: Mastering Web Developer Interview Code

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

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

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

课程: 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,…

内容