Last active
November 15, 2022 18:30
-
-
Save nathan-hyan/6405080f79945bf7fac9b0d3b3601393 to your computer and use it in GitHub Desktop.
SCSS Responsive Mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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