Skip to content

Instantly share code, notes, and snippets.

@joellesenne
Last active September 7, 2020 13:41
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 joellesenne/a645ab17f8de3cb28723b2b1a5db9abf to your computer and use it in GitHub Desktop.
Save joellesenne/a645ab17f8de3cb28723b2b1a5db9abf to your computer and use it in GitHub Desktop.
Media Queries in SCSS
// Media Queries in SCSS <https://css-tricks.com/approaches-media-queries-sass/#landon-schropps-technique>
// Variables
$tablet-width: 768px;
$desktop-width: 1024px;
@mixin tablet {
@media (min-width: #{$tablet-width}) and (max-width: #{$desktop-width - 1px}) {
@content;
}
}
// Mixins
@mixin desktop {
@media (min-width: #{$desktop-width}) {
@content;
}
}
// How to use
// @include tablet {
// @content here
// }
// Output
// @media (min-width: 768px) and (max-width: 950px) {
// @content here
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment