Created
December 16, 2021 13:10
-
-
Save Uvacoder/6c4e9ca13f31e930b2ddbe6653d621d1 to your computer and use it in GitHub Desktop.
CSS Flexbox with specified number of boxes in rows
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
| .flex-container { | |
| display: flex; | |
| flex-wrap: wrap; | |
| --flex-gap: 1.25rem; | |
| gap: var(--flex-gap); | |
| } | |
| .flex-child { | |
| --flex-items-per-row: 3; | |
| width: calc( | |
| calc(100% - calc(var(--flex-items-per-row) * var(--flex-gap))) / | |
| var(--flex-items-per-row) | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment