Skip to content

Instantly share code, notes, and snippets.

@kennyadsl
Created December 11, 2012 14:49
Show Gist options
  • Save kennyadsl/4259075 to your computer and use it in GitHub Desktop.
Save kennyadsl/4259075 to your computer and use it in GitHub Desktop.
Scss responsive mixin
/* Devices sizes */
$tablet-width: 768px;
$mobile-width: 420px;
/* Responsive breakpoints */
$break-small: $mobile-width;
$break-large: $tablet-width;
@mixin respond-to($media) {
@if $media == mobile {
@media only screen and (max-width: $break-small) { @content; }
}
@else if $media == tablet {
@media only screen and (max-width: $break-large - 1) { @content; }
}
@else if $media == desktop {
@media only screen and (min-width: $break-large) { @content; }
}
}
a {
margin: 0;
@include respond-to(tablet) { margin: 0 20px 0 0; }
@include respond-to(mobile) { margin: 0 0 10px 0; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment