4 ms·
Nesting is useful, but not as useful as you think. It’s great for keeping your pseudo-selectors close to your selectors. It’s great for faking scoping, by wrap
by the_other 5y ago
Nesting is useful, but not as useful as you think.
It’s great for keeping your pseudo-selectors close to your selectors. It’s great for faking scoping, by wrapping a whole file in the whole file in a single classname labelling your component.
But nesting also increases specificity and can distribute the name of a selector token across multiple places within the source file making debugging much harder.
If you use nesting as an aid to writing more CSS faster, you’re using it wrong. If you use it as an aid to constructing what would be a neat CSS file without nesting, then you’re doing it right.