Skip to content

Instantly share code, notes, and snippets.

@jescalan
Created February 13, 2012 22:11
Show Gist options
  • Select an option

  • Save jescalan/1820905 to your computer and use it in GitHub Desktop.

Select an option

Save jescalan/1820905 to your computer and use it in GitHub Desktop.
responsive
=responsive($to)
@if $to == phone
@media only screen and (max-width: 479px)
@content
@else if $to == landscape
@media only screen and (min-width: 480px) and (max-width: 767px)
@content
@else if $to == tablet
@media only screen and (min-width: 768px) and (max-width: 959px)
@content
@else if type-of($to) == number
@media only screen and (max-width: $to + px)
@content
@else if type-of($to) == list
@media only screen and (min-width: nth($to, 1) + px) and (max-width: nth($to, 2) + px)
@content
@else
@warn The mixin doesn't want what you're servin up. Check the documentation for usage details
// Usage
.header
width: 200px
float: left
+responsive(phone)
width: 100%
color: blue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment