I want to make a grid where all grid area parts are squares (grid column width = grid row height). It should be responsive and the device width should decide the 1fr width value (see below).
#gridParent {
margin: 5rem 14rem;
}
#grid {
grid-template-areas:
"a a b b"
"a a c d"
"e e f f"
"g g f f"
"k l h h"
"i i j j";
grid-template-columns: repeat(4, 1fr);
gap: 2rem;
}
<div id="gridParent">
<div id="grid">
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
<div class="gridItem"></div>
</div>
</div>
now I would like to somehow calculate the rows height so the it is the same as the 1fr column width pixelwise(!)
grid-auto-rows: auto;
is not working for me.
grid-auto-rows: 1fr;
same goes for this.
Basically every grid area part ( every single "a" from the 2x2-"a" should be a sqare...) is that possible to do?
I also tried aspect ratio but this doesnt work with the 2x2 area parts and the 1x1 or 2x1 area parts in one row...