Chapter 6
Selecting Stuff with Selectors
IN THIS CHAPTER
Figuring out parents, children, siblings, and other CSS kinfolk
Understanding why selectors are so darned important
Selecting elements by type, class, or id
Targeting child and sibling elements
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> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access