Last active
September 17, 2025 03:56
-
-
Save nichoth/4f240f1bf8df745d6a6bd842b94b117b to your computer and use it in GitHub Desktop.
Responsive grid
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
| /* | |
| see https://smolcss.dev/#smol-css-grid | |
| */ | |
| .smol-css-grid { | |
| --min: 15ch; | |
| --gap: 1rem; | |
| display: grid; | |
| grid-gap: var(--gap); | |
| /* min() with 100% prevents overflow in extra narrow spaces */ | |
| grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min)), 1fr)); | |
| } | |
| /* | |
| See https://gomakethings.com/how-to-build-a-reusable-grid-system-with-css-grid/ | |
| This creates a 12 column grid. | |
| */ | |
| .row { | |
| display: grid; | |
| grid-template-columns: repeat(12, 1fr); | |
| grid-template-rows: 1fr auto; | |
| column-gap: 1em; | |
| margin-bottom: 2rem; | |
| border-bottom: 1px solid; | |
| padding-bottom: 2rem; | |
| } | |
| .col-half { | |
| grid-column: auto / span 6; | |
| } | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
markup for the 12 column grid
This example is a 2 column layout, with 2 rows.