concept

specificity — CSS reference

Specificity compares three counts lexicographically after higher-priority cascade criteria tie. Universal selectors and combinators add zero. Inline styles, origin, layer and importance are not additional selector digits.

Formal Syntax & Structure

css syntaxcss
(ID count, class-like count, type-like count)

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); }#a { color: rgb(0, 96, 80); } .notice { color: rgb(32, 32, 32); }</style></head><body><p id="a" class="sample notice">A</p><p id="b" class="sample notice">B</p></body></html>
CSS Reference