Syntax Reference

The first table lists the general Selectors to open a block of declarations (i.e. enumerated property-value associations in curly braces) Selectors can be combined with Combinators. Elements matching selector in the tree may apply styles based on the resulting specificity. The Attribute selector may use Attribute selector operators to target subsets of values, see second table.

Selectors
Type XElements tag X
Universal *All elements
Attribute [X]See below
ID #XEquiv. [id=X]
Class .XEquiv. [class~=X]
Pseudo-Class :Xc.f. Lookup
Func. Pseudo-Class :X()c.f. Lookup
Pseudo-element ::Xc.f. Lookup
Nesting {&X}Extends parent sel.
Attribute Selectors
Presence [k]Matches empty value
Exact [k = 'v']Exact entire value
Hyphen [k |= 'v']Exact any v, or v-*
Contains Word [k ~= 'v']Exact any space-sep.
Substring Prefix [k ^= 'v']Prefix of value
Substring Infix [k *= 'v']Substring in value
Substring Suffix [k $= 'v']Suffix of value
Case-Insensitive [... i]For id, class, dataset
Case-Sensitive [... s]For other attrs

Sample Affixes