Prev | Current Page 64 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

A simple selector can either be an
element type selector (p. 62) or the universal selector (p. 60), (*), optionally followed
by attribute selectors (p. 67), ID selectors (p. 65), or pseudo-classes (p. 80).1 A
selector can comprise a number of simple selectors separated by combinators (p. 73),
1 Note that in CSS3, simple selectors are defined slightly differently than they are in CSS2.1. See
Selector Reference (p. 59) for details.
27 General Syntax and Nomenclature
but it can contain only one pseudo-element (p. 106), which must be appended to the
last simple selector in the chain.
Here??™s a more complex selector:
h2+p.warning:first-line {
color: #666;
font-weight: bold;
}
This selector consists of two simple selectors separated by an adjacent sibling
combinator (p. 77) (the + character), and a pseudo-element (:first-line). The first
simple selector (h2) is a type selector. The second simple selector contains a type
selector (p) and an attribute selector (p. 67)??”in this case, a special form of attribute
selector called a class selector (p.


Pages:
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76