Created
November 11, 2024 13:07
-
-
Save andxbes/01c87e679b01fbc97135fb33384f595a to your computer and use it in GitHub Desktop.
flex wrap colums with gap
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 { | |
--list-gap: 24px; | |
--columns: 3; | |
display: flex; | |
justify-content: center; | |
gap: var(--list-gap); | |
flex-direction: column; | |
@media screen and (min-width: 769px) { | |
flex-direction: row; | |
flex-wrap: wrap; | |
} | |
& > * { | |
max-width: 100%; | |
@media screen and (min-width: 769px) { | |
width: calc(100% / var(--columns) - (var(--list-gap) / 2) - (var(--list-gap) / 2 / var(--columns))); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment