Last active
June 10, 2025 18:15
-
-
Save MrGrigri/d9f5539b9c05cddabc4e98382978b807 to your computer and use it in GitHub Desktop.
grid auto-fit and auto-fill
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
@property --min-inline-size { | |
syntax: "<length>"; | |
inherits: false; | |
initial-value: 100px; | |
} | |
.container { | |
display: grid; | |
grid-template-rows: var(--min-inline-size); | |
grid-auto-rows: var(--min-inline-size); | |
gap: 10px; | |
&.container--auto-fit { | |
grid-template-columns: repeat( | |
auto-fit, | |
minmax(var(--min-inline-size), 1fr) | |
); | |
} | |
&.container--auto-fill { | |
grid-template-columns: repeat( | |
auto-fill, | |
minmax(var(--min-inline-size), 1fr) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment