CSS [attribute~=value]Selectors
Complete CSS Selector Reference Manual
Example
Select all elements whose title attribute contains the word "flower".
[title~=flower]
{
background-color:yellow;
}
Try it Yourself »
Definition and Usage
[attribute~=value] The selector is used to select elements whose attribute value contains a specified word.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers supportattribute~=value] selector.
Note:[attribute~=valueTo run in IE8, a declaration is required<!DOCTYPE>.
Related Articles
CSS Tutorial:CSS Attribute Selectors
Complete CSS Selector Reference Manualother extensions