Skip to content

Instantly share code, notes, and snippets.

@munkacsitomi
Last active February 19, 2020 14:23
Show Gist options
  • Save munkacsitomi/2240d57140284e924eadcfec43d71701 to your computer and use it in GitHub Desktop.
Save munkacsitomi/2240d57140284e924eadcfec43d71701 to your computer and use it in GitHub Desktop.
My preferred way how to use responsive helpers
.only-extra-small {
@include show-only-extra-small;
}
.only-medium-up {
@include show-medium-up;
}
.only-small-up {
@include show-small-up;
}
$extra-small: 480px;
$small: 736px;
$medium: 980px;
$large: 1280px;
$extra-large: 1281px;
@mixin extra-small {
@media all and (max-width: $extra-small) {
@content;
}
}
@mixin small {
@media all and (max-width: $small) {
@content;
}
}
@mixin small-up {
@media all and (min-width: $extra-small) {
@content;
}
}
@mixin medium {
@media all and (max-width: $medium) {
@content;
}
}
@mixin medium-up {
@media all and (min-width: $small) {
@content;
}
}
@mixin large {
@media all and (max-width: $large) {
@content;
}
}
@mixin large-up {
@media all and (min-width: $medium) {
@content;
}
}
@mixin extra-large {
@media all and (min-width: $extra-large) {
@content;
}
}
@mixin show-only-extra-small {
@media all and (min-width: $extra-small + 1) {
display: none;
}
}
@mixin show-medium-up {
@media all and (max-width: $small) {
display: none;
}
}
@mixin show-small-up {
@media all and (max-width: $extra-small + 1) {
display: none;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment