Skip to content

Instantly share code, notes, and snippets.

@andxbes
Created November 11, 2024 13:07
Show Gist options
  • Save andxbes/01c87e679b01fbc97135fb33384f595a to your computer and use it in GitHub Desktop.
Save andxbes/01c87e679b01fbc97135fb33384f595a to your computer and use it in GitHub Desktop.
flex wrap colums with gap
.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