Copied from

CSS3 Selectors

Part of the CSS3 For Dummies Cheat Sheet

CSS3 provides access to a wide variety of selectors that you use to identify which element to format on a page. A selector defines what to format; the style defines how to format it. However, it’s easy to go into selector overload. Most developers use a combination of tag and attribute selectors to perform all selector-related tasks. Here are the commonly used tag selectors, which provide overall selection methodologies.

In order to provide fine selection of just the right elements, developers often use attribute selectors in place of tag selectors. Here are the attribute selectors that developers commonly use.

A special not() selector completes the common array of selectors. To tell the browser not to select a particular tag or attribute, but to select everything else instead, you use the :not() selector. For example, :not(p) would select everything but the paragraph tags on the page.