Basic example
example.css
.card {
padding: 1rem;
& h2 { margin: 0; }
&:hover { outline: 2px solid #0ea5e9; }
}
Native CSS nesting lets you write child and pseudo rules inside a parent block, reducing repetition.
.card {
padding: 1rem;
& h2 { margin: 0; }
&:hover { outline: 2px solid #0ea5e9; }
}.card {
padding: 1rem;
& h2 { margin: 0; }
&:hover { outline: 2px solid #0ea5e9; }
}.card {
padding: 1rem;
& h2 { margin: 0; }
&:hover { outline: 2px solid #0ea5e9; }
}CSS Nesting is a modern CSS feature.
Supported in current major browsers with progressive enhancement.
Bottom line: Keep a readable fallback when using newer syntax.
Continue with Responsive Design.
CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
2 people found this page helpful