Chapter 3

Pseudo School: Learning Pseudo-Classes and Pseudo-Elements

IN THIS CHAPTER

Bullet Getting a handle on pseudo-classes

Bullet Selecting child elements

Bullet Styling elements by type, state, or user action

Bullet Taking your selector game up a notch with functional pseudo-classes

Bullet Giving some pseudo-elements a spin

pseudo: adj., almost, approaching, or trying to be.

—DICTIONARY.COM

When you work with CSS, what you’re essentially doing is applying styles to the HTML that you used to build the structure of the page. Your CSS rules deal with real (as far as things like HTML tags can be considered “real,” that is) things like headings (h1, h2, and so on), paragraphs (p elements), links (a elements), and images (img elements).

However, your page has a hidden world that's not evident (at least not explicitly) in its HTML code. Has a page visitor selected a checkbox or radio button? Is a user hovering the mouse pointer over an image? Has the user visited one of your links in the past? Is a particular element ...

Get HTML, CSS, & JavaScript All-in-One For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.