Write maintainable CSS with variables, nesting, mixins, modules, maps, and compiled output.
Lessons
Nest and manage media queries cleanly.
Media Queries in Sass is easiest to learn by reading the example, changing it, and observing the result.
$breakpoints: (sm: 576px, md: 768px, lg: 992px);
@mixin respond($key) {
@media (min-width: map-get($breakpoints, $key)) {
@content; // the block passed in is inserted here
}
}
.card {
padding: 1rem;
@include respond(md) {
padding: 2rem;
}
}Practice the Media Queries in Sass example in a small scratch file, then explain what changed and why.