selector

attribute-substring — CSS reference

Matches a nonempty fragment anywhere in the attribute string. Avoid using it in place of token matching for class-like attributes.

Formal Syntax & Structure

css syntaxcss
[attr*="fragment"]

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }[data-role*="note"] { color: rgb(0, 96, 80); }</style></head><body><p id="a" class="sample" data-role="old-note-new">A</p><p id="b" class="sample" data-role="notice">B</p></body></html>
CSS Reference