Write maintainable CSS with variables, nesting, mixins, modules, maps, and compiled output.
Lessons
Create reusable media-query mixins.
Responsive Breakpoint Mixins 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 Responsive Breakpoint Mixins example in a small scratch file, then explain what changed and why.