Nesting selector
noun
say it: “NEST-ing sih-LEK-ter” /ˈnɛstɪŋ sɪˈlɛktər/ or “AM-per-sand” /ˈæmpərsænd/
The & sign (ampersand) in nested CSS. It stands for the parent rule's selector, so &:hover inside .button means .button:hover.
What does & mean in nested CSS?
The nesting selector & stands for the parent rule's selector, used to attach states like :hover or modifier classes.
.button {
background: navy;
&.danger { background: firebrick; } /* .button.danger */
}
In a sentence
- “I wrote &:hover with the nesting selector inside .game-card, so the card itself lifts on hover, not the things inside it.”
Level: Freelancer · More CSS terms at this level
Updated