concept

Matched CSS rules

A selector match means a rule targets the selected element. Conditions such as media queries and the cascade still determine whether a declaration contributes to the final style. Distinguish matching selectors from inherited values and overridden declarations.

Formal Syntax & Structure

css syntaxcss
element.matches(".note") // JavaScript selector check

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>CSS reference demo</title><style>.note { color: #184168; } #sample { color: #155a3d; }</style></head><body><p id="sample" class="note">Field note</p></body></html>
CSS Reference