selector
attribute-word — CSS reference
Matches a complete whitespace-delimited token. A partial word or a token containing whitespace does not match.
Formal Syntax & Structure
css syntaxcss
[attr~="token"]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="urgent note">A</p><p id="b" class="sample" data-role="notebook">B</p></body></html>