Set a background color on all <div> elements that have a class attribute value that begins with "test":
More "Try it Yourself" examples below.
The [attribute^=value] selector matches every element whose attribute value begins with a specified value.
Version: | CSS3 |
---|
The numbers in the table specifies the first browser version that fully supports the selector.
Selector | |||||
---|---|---|---|---|---|
[attribute^=value] | 4.0 | 7.0 | 3.5 | 3.2 | 9.6 |
Note: For this selector to work in IE8 and earlier, a <!DOCTYPE> must be declared.
Set a background color on all elements that have a class attribute value that begins with "test":
CSS tutorial: CSS Attribute Selectors