CSS [attribute~=value] Selector
Example
Select and style all elements with a title attribute that contains the word "flower":
[title~="flower"]
{
border: 5px solid green;
}
Try it Yourself »
Definition and Usage
The CSS [attribute~=value]
selector is used to select elements with an attribute value containing a specific word.
The example above will match elements with title="flower", title="summer flower", and title="flower new", but not title="my-flower" or title="flowers".
Version: | CSS2 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the selector.
Selector | |||||
---|---|---|---|---|---|
[attribute~=value] | 4.0 | 7.0 | 2.0 | 3.1 | 9.6 |
CSS Syntax
Related Pages
CSS tutorial: CSS Attribute Selectors