Chapter 5. Selectors

<feature><title>What You’ll Learn in This Hour:</title>
  • More about simple selectors you’ve already been using

  • How to use class and id selectors

  • What the universal selector is and when to use it

  • What pseudo-classes and pseudo-elements are and how they can be used

  • How to specify styles that affect hypertext links

As you learned in Hour 2, “Getting Started with CSS,” selectors are the part of the CSS rule that identifies the target of the styling. Putting the power of selectors to use is vital for getting the most out of CSS.

</feature>

Simple Selectors

You’ve seen the simplest type of selectors already: type selectors, class selectors, and id selectors. In this hour, you’ll look at how you can use them more effectively.

So far you ...

Get Sams Teach Yourself CSS 24 in Hours 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.