CSS [attribute~=value] Selector

❮ Previous Selectors Next ❯

Example

p[title~="World"] { 
  background-color: red;
}

Meaning

The [attribute~=value] selector select elements with an attribute value containing a specified word.

The above example selects all elements with a title attribute that contains a space-separated list of words, one of which is "World":

Version: CSS2




Standard Syntax

[attribute~=value] {
  css declarations;
}



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







❮ Previous Selectors Next ❯