I want to create a grid with sensitive squares.
It seems to me that I can do this using the CSS Grid layout, but the problem is setting the height of each square equal to the width.
There is also a problem with installing a gutter between each square.
Would it be better to use flexbox?
Currently, my HTML looks like this, but it will be dynamic, so more squares can be added. And, of course, it should be responsive, so itβs ideal to use a media query to collapse it to one column.
<div class="square-container"> <div class="square"> <div class="content"> </div> </div> <div class="square"> <div class="content spread"> </div> </div> <div class="square"> <div class="content column"> </div> </div> </div>
Using the css grid, this is how much I got
.square-container{ display: grid; grid-template-columns: 30% 30% 30%; .square { } }
I managed to do a little work with flexbox and use the space between the square alignments with a nice gutter, but he was still trying to get a height corresponding to the width of each square.
I was not able to find examples of how this is done using flexbox or the grid, but any examples would be appreciated as well.
thanks
source share