CSS [attribute$=value] Selector
Example
Style all <div> elements that have a class attribute value that ends with "test":
div[class$="test"]
{
background: salmon;
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The CSS [attribute$=value]
selector
matches every element whose attribute value ends with the specified value.
Version: | CSS3 |
---|
Browser Support
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 |
CSS Syntax
More Examples
Example
Style all elements that have a class attribute value that ends with "test":
[class$="test"]
{
background: salmon;
}
Try it Yourself »
Related Pages
CSS tutorial: CSS Attribute Selectors