CSS3/Selectors/attribute selector/attribute*=value

From W3C Wiki

[attributename*="val"]

This selector represents an element with the "attributename" attribute whose value contains at least one instance of the substring "val".


Syntax

elementname[attributename*="val"]{ properties }


Point, Note

  • If "val" is the empty string then the selector does not represent anything.


Example

[style.css]

 h1[title*="HTML5"]{
   color: red;
 }

[index.html]

<body>
  <h1 title="About HTML5">About HTML5</h1>
  <h1 title="HTML5 Spec">HTML5 Spec</h1>
  <h1 title="New HTML5 Element">New HTML5 Element</h1>
</body>

The CSS Selectors Level 3 specification defines the attribute selector in 6.3.2. Substring matching attribute selectors.