Created
August 15, 2019 11:45
-
-
Save colxi/10d8fc2b9c9c2053c9d980fe04ebcc1b to your computer and use it in GitHub Desktop.
Adaptive grid layout (adjust min and max width, and elements per row)
This file contains 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
<!-- behaviour example (gif) :https://cdn-images-1.medium.com/max/800/1%2A1FOrkyNbaabo3_LJxcdDbg.gif --> | |
<style> | |
.container { | |
display: grid; | |
grid-gap: 5px; | |
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); | |
grid-template-rows: repeat(2, 100px); | |
} | |
</style> | |
<div class="container"> | |
<div>1</div> | |
<div>2</div> | |
<div>3</div> | |
<div>4</div> | |
<div>5</div> | |
<div>6</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment