Created
September 2, 2019 15:14
-
-
Save morgyface/16a6be432a282b094e551a9cee1d8715 to your computer and use it in GitHub Desktop.
CSS | Grid layout with crude non-supporting fallback for IE
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
| .list { | |
| margin: 0; | |
| padding-left: 0; | |
| list-style-type: none; | |
| @media only screen and (min-width: $breakpoint-sm) { | |
| display: grid; | |
| grid-column-gap: 50px; | |
| grid-row-gap: 100px; | |
| grid-template-columns: repeat(2, 1fr); | |
| } | |
| @media only screen and (min-width: $breakpoint-md) { | |
| grid-template-columns: repeat(3, 1fr); | |
| } | |
| @media only screen and (min-width: $breakpoint-lg) { | |
| grid-template-columns: repeat(4, 1fr); | |
| } | |
| &__item { | |
| @media only screen and (min-width: $breakpoint-sm) { | |
| display: inline-block; | |
| max-width: 49%; | |
| } | |
| @media only screen and (min-width: $breakpoint-md) { | |
| max-width: 32%; | |
| } | |
| @media only screen and (min-width: $breakpoint-lg) { | |
| max-width: 24%; | |
| } | |
| @supports (display: grid) { | |
| display: block; | |
| max-width: unset; | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Grid. Lovely grid.
This replaces a rather verbose float, calc and clear gist.
The
&__itemstyles could be deleted or simplified further depending on how you feel about Internet Explorer. The above maintains a crude grid in IE11.Notes on IE and Edge