selector

attribute-exact — CSS reference

Matches the entire attribute value; additional tokens or spaces can prevent a match. Case rules depend on document language and modifiers.

Formal Syntax & Structure

css syntaxcss
[attr="value"]

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="note">A</p><p id="b" class="sample" data-role="note urgent">B</p></body></html>
CSS Reference