From the course: Making Sense of the CSS Box Model

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Pseudo elements: Making the browser hallucinate

Pseudo elements: Making the browser hallucinate - CSS Tutorial

From the course: Making Sense of the CSS Box Model

Start my 1-month free trial

Pseudo elements: Making the browser hallucinate

- [Instructor] Now that I've shown you the power of the clear fix, it's worth taking a moment to address the technology that makes this possible, pseudo elements. In CSS we have a long list of pseudo classes that allow us to target specific states of elements. These are classes like active, focus, hover, nth-child, and so on. These classes can be used to alter the display or behavior of all the content inside an element box. In contrast, pseudo elements allow us to apply style to a certain part of an element or document. Furthermore, these pseudo elements are regular CSS boxes an adhere to the CSS box model in the same way that other elements would. That gives us some pretty cool opportunities. The available pseudo elements that we have are before, after, first-letter, first-line, selection, and the pretty much unsupported backdrop. The four that are well supported are used for different things and can be quite useful.…

Contents