Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active December 14, 2015 09:09
Show Gist options
  • Save magnetikonline/5062868 to your computer and use it in GitHub Desktop.
Save magnetikonline/5062868 to your computer and use it in GitHub Desktop.
Sass media query @mixin example.
$breakSmall: 320px;
$breakLarge: 1024px;
@mixin respondTo($media) {
@if ($media == handhelds) {
@media only screen and (max-width: $breakSmall) { @content; }
}
@else if ($media == medium-screens) {
@media only screen and (min-width: $breakSmall + 1) and (max-width: $breakLarge - 1) { @content; }
}
@else if ($media == wide-screens) {
@media only screen and (min-width: $breakLarge) { @content; }
}
}
.profile-pic {
float: left;
width: 250px;
@include respondTo(handhelds) { width: 100% ;}
@include respondTo(medium-screens) { width: 125px; }
@include respondTo(wide-screens) { float: none; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment