Last active
May 25, 2019 19:13
-
-
Save mherchel/1c2b5c919e084af378d8fce635925182 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Wraps ruleset within media and @supports queries that only affect browsers that don't support grid. | |
@mixin no-grid { | |
@media (-ms-high-contrast: none), (-ms-high-contrast: active) { | |
@content; | |
} | |
@supports not (display: grid) { | |
@content; | |
} | |
} | |
// Usage | |
.selector { | |
@include grid-container; // Assume this holds the grid content rules. | |
@include no-grid { | |
// Insert flexbox fallback code | |
} | |
} | |
// Will compile down to the following: | |
.selector { | |
display: grid; | |
grid-template-rows: repeat(12, 1fr); | |
grid-column-gap: 30px; | |
/* the -ms-high-contrast mq only affects IE10/IE11 */ | |
@media (-ms-high-contrast: none), (-ms-high-contrast: active) { | |
/* Flexbox fallback code */ | |
} | |
@supports not (display: grid) { | |
/* Flexbox fallback code */ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment