Skip to content

Instantly share code, notes, and snippets.

@mejiaj
Created March 10, 2015 15:56
Show Gist options
  • Select an option

  • Save mejiaj/23975d268017fe106fe5 to your computer and use it in GitHub Desktop.

Select an option

Save mejiaj/23975d268017fe106fe5 to your computer and use it in GitHub Desktop.
SCSS Media Queries using maps and a mixin.
/*
* Based on sitepoint article by Hugo Giraudel
* http://www.sitepoint.com/managing-responsive-breakpoints-sass/
*/
$breakpoints: (
small: 300/16 + 0em,
medium: 500/16 + 0em,
large: 850/16 + 0em
);
@mixin mq($breakpoint) {
@if map-has-key($breakpoints, $breakpoint) {
// Goes to $breakpoints map and gets the $breakpoint value
@media only screen and ( min-width: #{map-get( $breakpoints, $breakpoint )} ) { @content; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment