CSS/Selectors/attribute selector/attribute*=value

From Web Education Community Group
< CSS‎ | Selectors
Jump to: navigation, search

[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>

Css3 selectors att 007.png

CSS defines the attribute selector in 6.3.2. Substring matching attribute selectors.