Prev | Current Page 110 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"


Attribute selectors were introduced in
CSS2, and CSS3 added a few more
(p. 71).
Attribute selectors are delimited by
Selector Reference
67 Selector Reference
square brackets; the simplest form of an
attribute selector consists of an attribute name surrounded by square brackets:
[href] {
?‹® declarations
}
This example selector matches any element that has an href attribute. It also contains
an implied universal selector, and is equivalent to *[href].
Here??™s another example:
a[href] {
?‹® declarations
}
This selector matches any a element that has an href attribute, so it matches a
hypertext link, but not a named anchor.
Attribute selectors can also specify a value, or a partial value, to match. The values
must be strings (p. 37), in which case they??™re surrounded by single or double quotes,
or identifiers (p. 43), without quotes. All the examples below use strings.
Case Sensitivity
The value specified in an attribute selector is case sensitive if the attribute value in
the markup language is case sensitive.


Pages:
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122