h2[align="left"]
{ cursor: hand }
[Matches all occurrences of the element named 'h2' using an 'align'
attribute set to 'left'.]
"Begins-with" Attribute Value Selector
[CSS3]
[N6|S1]
Description:
Matches all elements with the specified attribute that BEGIN
with the specified value. This selector would match attribute values that
are equal to it as well as to longer values of which it is a substring.
h2[align^="left"]
{ cursor: hand }
[Matches all occurrences of the element named 'h2' using an 'align'
attribute where "left" is at the beginning of the value.]
"Ends-with" Attribute Value Selector
[CSS3]
[N6|S1]
Description:
Matches all elements with the specified attribute that END with the
specified value. This selector would match attribute values that are equal to it as
well as to longer values of which it is a substring.
h2[align*="left"]
{ cursor: hand }
[Matches all occurrences of the element named 'h2' using an 'align'
attribute where "left" is any part of the value.]
One-Of-Many Attribute Value Selector
[CSS2|CSS2.1|CSS3]
[N6|O4|S1]
Description:
This is a special form of the Attribute Value Selector, allowing a
portion of an attribute value to be exactly matched where the portions
of the attribute value are separated by spaces. This is especially
useful in HTML with the common CLASS attribute where multiple classes
can be assigned to a single element.
h3[class~="class2"]
{ font-weight: bold }
[would match <h3CLASS="class2"> and <h3CLASS="class1 class2">]
Hyphen Attribute Value Selector
[CSS2|CSS2.1|CSS3]
[N6|O4|S1]
Description:
This is another special form of the Attribute Value Selector, allowing a
portion of an attribute value to be exactly matched, where the portions of
the attribute value are separated by hyphens. The search for the attribute
value fragment always starts from the beginning of the value. This Selector
type is especially useful with RFC 1766 language values used in the HTML
common LANG attribute and the xml:lang attribute.
[foo|desc="value"]
{ color: red }
[references all DESC attributes in the FOO namespace that have a value of "value"]
Browser Peculiarities
Opera 4.0-5.x: the Hyphen Attribute Value selector seems to
have a small bug - Specified match values do not have to be at the
start of the value, eg: attr|="value" would match an attribute with
attr="foo-value". Opera 6+ handles this the correct way and
does not match this.