HTML and CSS Reference
declaration in a series, the terminating semicolon is optional. It's not a bad idea to get in the habit of
including a semicolon at the end of every declaration, even when there's only one, just to play it safe.
If your CSS doesn't conform to this basic structure and syntax—if you forget the closing brace or the colon
separating a property from its value, for example—the entire rule or even the entire style sheet might fail.
Just like HTML, a style sheet should be well formed and properly constructed. The W3C hosts a CSS
catch goofs and glitches in your style sheets.
Figure 2-3. The W3C CSS Validation Service
A selector, as its name implies, selects an element in your HTML document. A number of different types of
selectors are available, with varying levels of specificity to target a large number of elements or just a few.
Specificity is a means of measuring a given selector's scope; in other words, how many or few elements it
selects. CSS is designed so that more specific selectors override and supersede less specific selectors.
Specificity is one of the more nebulous and hard-to-grasp concepts in CSS but it's also one of the most
powerful features of the language. We'll cover the rules of specificity in more detail later, but first allow us
to introduce some selectors.
The universal selector is merely an asterisk ( * ) acting as a “wild card” to select any and all elements in the
document. For example, this rule: