Created
May 2, 2020 07:12
-
-
Save francoisgeorgy/85783d22b1bb780bc893cd3f1631307f to your computer and use it in GitHub Desktop.
responsive #css #gridgrid layout
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
| /* | |
| AUTO GRID | |
| Set the minimum item size with `--auto-grid-min-size` and you'll | |
| get a fully responsive grid with no media queries. | |
| */ | |
| .auto-grid > * { | |
| max-width: 25rem; | |
| margin-left: auto; | |
| margin-right: auto; | |
| } | |
| .auto-grid > * + * { | |
| margin-top: 1rem; | |
| } | |
| @supports(display: grid) { | |
| .auto-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(var(--auto-grid-min-size, 16rem), 1fr)); | |
| grid-gap: 1rem; | |
| } | |
| .auto-grid > * { | |
| max-width: unset; | |
| margin: unset; | |
| } | |
| } | |
| /* | |
| WRAPPER | |
| A utility with a max width that contains child elements and horizontal centers them | |
| */ | |
| .wrapper { | |
| max-width: 55rem; | |
| margin: 0 auto; | |
| padding: 0 1rem; | |
| } | |
| /* Presentational styles */ | |
| body { | |
| background: #efefef; | |
| padding: 1rem; | |
| line-height: 1.4; | |
| font-family: Georgia, serif; | |
| font-size: 1.5rem; | |
| } | |
| li span { | |
| display: block; | |
| padding: 5rem 1rem; | |
| text-align: center; | |
| background: hsl(338,81%,41%); | |
| color: #ffffff; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment