Skip to content

Instantly share code, notes, and snippets.

@mrakowski0
Last active December 15, 2015 13:58
Show Gist options
  • Select an option

  • Save mrakowski0/5271060 to your computer and use it in GitHub Desktop.

Select an option

Save mrakowski0/5271060 to your computer and use it in GitHub Desktop.
Nested media queries
@mixin respond-to($media, $direction: max) {
@if $media == mobile {
@media only screen and (max-width: 320px) { @content; }
}
@else if $media == tablet {
@media only screen and (min-width: 768px) { @content; }
}
@else if $media == desktop {
@media only screen and (min-width: 1024px) { @content; }
}
@else if $media == large {
@media only screen and (min-width: 1400px) { @content; }
}
@else {
@media only screen and (#{$direction}-width: #{$media}) { @content; }
}
}
body {
font-size: 14px;
font-family: "Open Sans", sans-serif;
@include respond-to(tablet) { font-size: 16px; }
@include respond-to(desktop) { font-size: 18px; }
@include respond-to(large) { font-size: 20px; }
}
#gallery {
li {
margin: 0 20px;
@include respond-to(desktop) { float: left; width:50%;}
@include respond-to(1400px, min) { width:33.33%; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment