Skip to content

Instantly share code, notes, and snippets.

@eduardoboucas
Created January 4, 2016 12:33
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 eduardoboucas/3c22701a3f046352b94f to your computer and use it in GitHub Desktop.
Save eduardoboucas/3c22701a3f046352b94f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
@import "include-media";
$breakpoints:(
'small': 400px,
'large': 1200px
);
$num-breakpoints: length($breakpoints);
@mixin hidden($type, $breakpoint) {
.hidden--#{$type}-#{$breakpoint} {
display: none;
}
}
@for $i from 1 through $num-breakpoints {
$breakpoint: nth($breakpoints, $i);
$breakpoint-name: nth($breakpoint, 1);
// For
@if $i == $num-breakpoints {
@include media('>=#{$breakpoint-name}') {
@include hidden('for', $breakpoint-name);
}
} @else {
$next-breakpoint: nth($breakpoints, $i + 1);
$next-breakpoint-name: nth($next-breakpoint, 1);
@include media('>=#{$breakpoint-name}', '<#{$next-breakpoint-name}') {
@include hidden('for', $breakpoint-name);
}
}
// From
@include media('>=#{$breakpoint-name}') {
@include hidden('from', $breakpoint-name);
}
// To
@include media('<#{$breakpoint-name}') {
@include hidden('to', $breakpoint-name);
}
}
@media (min-width: 400px) and (max-width: 1199px) {
.hidden--for-small {
display: none;
}
}
@media (min-width: 400px) {
.hidden--from-small {
display: none;
}
}
@media (max-width: 399px) {
.hidden--to-small {
display: none;
}
}
@media (min-width: 1200px) {
.hidden--for-large {
display: none;
}
}
@media (min-width: 1200px) {
.hidden--from-large {
display: none;
}
}
@media (max-width: 1199px) {
.hidden--to-large {
display: none;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment