Skip to content

Instantly share code, notes, and snippets.

@LeoSeyers
Created November 7, 2021 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeoSeyers/4715f7ec2bdcb8ba6e54472a66b0e472 to your computer and use it in GitHub Desktop.
Save LeoSeyers/4715f7ec2bdcb8ba6e54472a66b0e472 to your computer and use it in GitHub Desktop.
SCSS Responsive Mixins
$bps: (
"phone-sm": 20em /* 320px; dinosaurs */,
"phone-md": 23.4em /* 374; Iphone 6 -> X */,
"phone-lg": 25.625em /* 410px; Pixel2 */,
"tab": 37.5em /* 600x; Ipad */,
"tab-lg": 56.25em /* 900px; Ipad Pro:1024px */,
"desktop": 75em /* 1200px */,
"desktop-md": 85.375em /* 1366px; 1366×768 (8.44%) */,
"desktop-lg": 112.5em /* 1800px; 1920×1080 (8.89%) */,
"desktop-xlg": 137.5em /* 2200px, 4K 24"+ */,
);
@mixin respond($breakpoint) {
$bp: map-get($bps, $breakpoint);
@media only screen and (min-width: $bp) {
@content;
}
}
@mixin max-width($breakpoint) {
$bp: map-get($bps, $breakpoint);
@media only screen and (max-width: $bp) {
@content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment