Skip to content

Instantly share code, notes, and snippets.

@TylerK
Last active August 29, 2015 14:01
Show Gist options
  • Save TylerK/2d8685f64cd5477e80ad to your computer and use it in GitHub Desktop.
Save TylerK/2d8685f64cd5477e80ad to your computer and use it in GitHub Desktop.
//
// Mixin for inline responsive design
//
$smallScreen : 768px;
$mediumScreen : 992px;
$largeScreen : 1200px;
@function smallerThan($breakPoint) {
@return "screen and (min-width:" + $breakPoint + ")";
}
@function largerThan($breakPoint) {
@return "(max-width:" + $breakPoint + ")";
}
@mixin forScreen($size) {
@if $size == $smallScreen {
@media #{smallerThan($mediumScreen)} and #{largerThan($smallScreen)} {
@content;
}
}
@if $size == $mediumScreen {
@media #{smallerThan($mediumScreen)} {
@content;
}
}
@if $size == $largeScreen {
@media #{smallerThan($largeScreen)} {
@content;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment