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?
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
-
-
-
How do you use the data- attribute in HTML?11m 14s
-
Are you comfortable using jQuery?11m 32s
-
Describe when you should use the bind() method5m 21s
-
Do you know how to use the conditional operator?3m 43s
-
Have you used Ajax to load an external file?8m 25s
-
Have you used JavaScript templates?7m 3s
-
How do you manipulate the DOM?11m 7s
-
How do you search using functional programming?6m 27s
-
How do you use a constructor to create instances?10m 33s
-
How do you use arrow functions in ES6?6m 30s
-
How do you use the Fetch API?7m 22s
-
How do you render JSON to a DOM element?9m 36s
-
How does an IIFE work?7m 12s
-
How does immutability work in JavaScript?4m 12s
-
How would you use JavaScript reduce()?3m 54s
-
Quick concepts: Do you have experience linting your code?2m 31s
-
What are event bubbling and propagation about?11m 42s
-
What does "use strict" do?3m 28s
-
What is a callback and how do you use it?8m 51s
-
What is the relationship between promises and callbacks?9m 57s
-
What is the virtual DOM?7m 7s
-
What is variable hoisting and how do you guard against it?8m 43s
-
What tooling options have you used in the past?7m 11s
-
When would you use recursion?6m 25s
-
Can you build a Sass mixin?7m 57s
-
Do you know how to use CSS variables?10m 38s
-
Animate an underline on hover in CSS9m 48s
-
Explain the difference between absolute and relative positioning7m 55s
-
How comfortable are you with Sass?12m 10s
-
How do you animate CSS?9m 41s
-
How do you debug CSS using your browser?10m 47s
-
How do you use calc() in CSS?9m 56s
-
How would you use flexbox to control horizontal alignment?7m 21s
-
In CSS, what's the difference between ems and rems?9m 58s
-
What's the difference between a pseudo-class and a pseudo-element?6m 16s
-
Do you know how to use npm?8m 40s
-
Do you have experience using version control?16m 37s
-
How does routing work in a modern web application?9m 30s
-
-
-