Chapter 2

CSS Selectors

In the previous chapter, we talked about how to build a CSS rule. You saw how a rule in a style sheet is made up of one or more selectors and by a group of properties and relevant values, expressed in the following form:

selector {

 property: value;


A selector represents a structure, meaning it specifies which elements of an HTML page the rule will apply to. The properties and the relevant values deal with the presentation of these elements.

Therefore, one can guess that selectors are a fundamental part of CSS. Indeed, they’ve been around since the very first CSS specifications. Selectors Level 1 and Selectors Level ...

Get CSS3 Solutions: Essential Techniques for CSS3 Developers now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.