Skip to main content
Documentation/The Editor/Selectors/Nested Selectors
The Editor

Nested Selectors

A nested selector is one you write yourself, derived from a class — .card .card-title,
.card.is-open, .card::after — rather than picked from the list of
states.

The same menu's Create Selector lets you write your own suffix instead of picking a
state. Click it and an inline field opens with the class name already fixed as the prefix:

The Create Selector field, prefixed with the parent class
The Create Selector field, prefixed with the parent class

Type the rest of the selector and press Enter. & again means the class itself:

You type The rule you get
& .demo-card-title .demo-card .demo-card-title — a descendant
&.is-open .demo-card.is-open — the class combined with another
&::after .demo-card::after — a pseudo-element
&:hover .demo-card-title .demo-card:hover .demo-card-title — a descendant on hover

The new selector becomes active immediately, and the chip shows both halves so you always
know what you're styling:

The class field while a nested selector is active
The class field while a nested selector is active

Nested selectors belong to their parent class: they travel with it, they're listed under
it in the Selectors panel and in this menu (with a dot on the ones that have styles), and
they're written into the stylesheet directly after the parent's rule.