Modern CSS: Native Nesting, Cascade Layers & Container Queries
Writing clean, resilient styles without Sass or Less.
CSS has experienced an incredible renaissance over the last three years. Features that previously mandated preprocessors are now universally supported.
Native Nesting in Action
.card {
background-color: var(--card-bg);
border-radius: 0.75rem;
& .card-header {
font-weight: 600;
}
&:hover {
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
}Cascade Layers (@layer)
Manage specificity cleanly without resorting to !important:
@layer reset, base, components, utilities;
@layer components {
.btn {
padding: 0.5rem 1rem;
}
}