Skip to content

Instantly share code, notes, and snippets.

@nathan-hyan
Last active November 15, 2022 18:30
Show Gist options
  • Save nathan-hyan/6405080f79945bf7fac9b0d3b3601393 to your computer and use it in GitHub Desktop.
Save nathan-hyan/6405080f79945bf7fac9b0d3b3601393 to your computer and use it in GitHub Desktop.
SCSS Responsive Mixin
// Shout out to YouTube channel "FrontDev" for this mixin
// that makes responsive so much easier to work with. You can check out the full tutorial on
// his video here: https://www.youtube.com/watch?v=1334bFDilgk&ab_channel=FrontDev
// Put your breakpoints here
$available-breakpoints: (
sm: 540px,
md: 768px,
lg: 1024px
);
// Change min with max if necessary
@mixin responsive($breakpoint) {
@media screen and (min-width: map-get($available-breakpoints, $breakpoint)){
@content
}
}
// Usage
.container {
background-color: pink;
@include responsive(sm){
background-color: blue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment