CSS3 & Modern Layouts (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
Native CSS Nesting Rules.
senior LevelCode ExampleSystem Design
In Simple Words: Modern browsers natively support CSS nesting without needing Sass or PostCSS:
css
.card {
background: white;
padding: 1.5rem;
& h2 {
color: #1e293b;
}
&:hover {
box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}
@media (max-width: 640px) {
padding: 1rem;
}
}
The & nesting selector explicitly represents the parent selector.