Skip to content

Instantly share code, notes, and snippets.

@dcrec1
Created August 23, 2012 21:17
Show Gist options
  • Save dcrec1/3441946 to your computer and use it in GitHub Desktop.
Save dcrec1/3441946 to your computer and use it in GitHub Desktop.
respond-to mixin
$mediaPhone: 480px !default
$mediaTablet: 768px !default
$mediaDesktop: 980px !default
$mediaLarge: 1200px !default
=respond-to($media)
@if $media == phone
@media only screen and (max-width: $mediaPhone)
@content
@else if $media == tablet
@media only screen and (max-width: $mediaTablet - 1)
@content
@else if $media == portrait
@media only screen and (min-width: $mediaTablet) and (max-width: $mediaDesktop - 1)
@content
@else if $media == desktop
@media only screen and (min-width: $mediaDesktop)
@content
@else if $media == large
@media only screen and (min-width: $mediaLarge)
@content
@dukex
Copy link

dukex commented Oct 17, 2012

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment