Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusasplund/f0ee568f9759530e4a21df8c54a8d4d4 to your computer and use it in GitHub Desktop.
Save marcusasplund/f0ee568f9759530e4a21df8c54a8d4d4 to your computer and use it in GitHub Desktop.
@mixin for-size($size) {
@if $size == phone-only {
@media (max-width: 599px) { @content; }
} @else if $size == tablet-portrait-up {
@media (min-width: 600px) { @content; }
} @else if $size == tablet-portait-only {
@media (min-width: 600px) and (max-width: 899px) { @content; }
} @else if $size == tablet-landscape-up {
@media (min-width: 900px) { @content; }
} @else if $size == tablet-landscape-only {
@media (min-width: 900px) and (max-width: 1199px) { @content; }
} @else if $size == desktop-up {
@media (min-width: 1200px) { @content; }
} @else if $size == desktop-only {
@media (min-width: 1200px) and (max-width: 1799px) { @content; }
} @else if $size == big-desktop-up {
@media (min-width: 1800px) { @content; }
}
}
// usage
.my-box {
padding: 10px;
@include for-size(desktop-up) {
padding: 20px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment