Skip to content

Instantly share code, notes, and snippets.

@jamespantalones
Created January 21, 2015 13:22
Show Gist options
  • Save jamespantalones/e403ffa368b17bef326d to your computer and use it in GitHub Desktop.
Save jamespantalones/e403ffa368b17bef326d to your computer and use it in GitHub Desktop.
jchambers micro media query
// ---------------------------------
// Media query breakpoints & mixin
//
// Usage:
//
// @include mq("BREAKPOINT_NAME") { //styles }
$breakpoints: (
"extra-small" 500px,
"small" 700px,
"medium" 1047px,
"large" 1300px,
"extra-large" 1450px,
"extra-extra-large" 1800px
);
@mixin mq($size, $type: "min-width") {
@each $breakpoint in $breakpoints {
@if ($size == nth($breakpoint, 1)) {
@media ($type: nth($breakpoint, 2)) {
@content;
}
}
}
}
.header {
// Mobile styles first...
padding: 1em;
@include mq("medium") {
// Add more padding for medium size screens...
padding: 2em;
}
@include mq("large") {
// And yet more on large screens
padding: 3em;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment