Chapter 6

Selecting Stuff with Selectors

IN THIS CHAPTER

Bullet Figuring out parents, children, siblings, and other CSS kinfolk

Bullet Understanding why selectors are so darned important

Bullet Selecting elements by type, class, or id

Bullet Targeting child and sibling elements

Bullet Getting a handle on pseudo-classes

In this chapter, you investigate the rich, useful, and incredibly powerful realm of CSS selectors. I take you through not only all the must-know selectors that are part of the coding repertoire of every web designer, but also a satisfyingly extensive tour of the broader selector toolkit.

Understanding Element Relationships

One of the key concepts in this chapter — and, indeed, one of the most useful concepts in all of CSS — is the set of relationships that exist between every element in a web page.

To help you understand these relationships, it’s useful to have an example to refer to over the next page or two, so here you go:

<html lang="en"> <head> <meta charset="UTF-8"> <title>So Many Kale Recipes</title> ...

Get HTML & CSS Essentials 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.