attribute

Attribute Contains Substring Selector

Selects elements whose named attribute contains the specified substring anywhere in its value. It is the most flexible substring attribute selector.

[attr*="value"]

Example

a[href*="utm_"] { opacity: 0.6; } /* HTML: <a href="/x?utm_source=g">Link</a> */

✓ Matches

  • <a href="/x?utm_source=g">a</a>
  • <a href="utm_medium">b</a>
  • <a href="foo/utm_/bar">c</a>

✗ Does not match

  • <a href="/plain">a</a>
  • <a href="utmsource">b</a>

Browser support

Universal support in all browsers since CSS3.

Related selectors

← All CSS selectors · CSS selectors cheat sheet