selector

compound-selector — CSS reference

Joins conditions with no combinator: one element must satisfy every component. Inserting whitespace changes the relationship to a descendant.

Formal Syntax & Structure

css syntaxcss
type.class[attr]

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