Last active
August 8, 2022 20:53
-
-
Save MariaJackson1/c079d644b261aae50ed037264a2e700c to your computer and use it in GitHub Desktop.
CSS Grid Layout for Modern Browsers
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
| /* ------------------------------------------ | |
| Basic one-column layout for all browsers | |
| --------------------------------------------*/ | |
| .grid-container { | |
| max-width: 50em; | |
| } | |
| .grid-container > * { | |
| text-align: center; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 2rem; | |
| padding: 1rem; | |
| } | |
| /* ------------------------------------------ | |
| CSS Grid layout for modern browsers | |
| --------------------------------------------*/ | |
| @supports (display: grid) { | |
| @media (min-width: 50em) { | |
| .grid-container { | |
| display: grid; | |
| margin: auto; | |
| grid-template-columns: repeat(4, 200px); | |
| grid-template-rows: repeat(2, 200px); | |
| grid-gap: 20px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment