Attribute selector, according to the attribute value selecting section
Use attribute selector matching substring
[Foo | = "bar"] foo attributes of the elements are selected, and the value (U + 002D) begin with a bar and a dash, or is itself bar itself
[Foo | = "bar"] foo selected element has attributes, and the bar is a set of words comprises the word
[Foo | = "bar"] foo attributes of the elements are selected, and the value substring bar comprising
[Foo | = "bar"] foo attributes of the elements are selected, and the value at the beginning of bar
[Foo | = "bar"] foo attributes of the elements are selected, and the value of bar ends
eg:[ lang | = "en" ] {
color:white;
}
The rule selection lang attribute value is en element or beginning en-
<h1 lang = "en"> attribute selector matching substring </ h1 of>
<P lang = "en-US"> en selected elements at the beginning or in the en- </ P>
<div lang = "en-Au" > first three above rule applies </ div>
<P lang = "fr"> this is not selected </ P>
<H2 lang = "CY-EN"> this is not selected </ h2>
Generally, [att | = "val"] may be used to select any form of attributes and their values. Suppose a html document in a series of illustrations, and the illustrations file name is figure-1.gif and figure-2.jpg this.
Using the following selectors match all illustrations:
img[src|="figure"] {
border: 1px solid gray;
}