I'm trying to make an html/css card system that automatically places itself on a css grid. This css grid is divided into two columns. In the left column, a div adds an offset to the rest of the column, and has no fixed size. I want to keep this offset between the two columns.
The problem is that the first card on the left (number 2) grows to compensate for the offset, but all cards must have the same size. How can I fix that without fixing the size of each card ?
What I would like to do:
What I currently have:
A simple example of code to reproduce it:
.grid {
display: grid;
background-color: #eee;
grid-gap: 5px 5px;
grid-template-columns: repeat(2, 1fr);
grid-auto-flow: dense;
}
.box {
background-color: #444;
color: #fff;
border-radius: 5px;
padding: 60px;
font-size: 150%;
}
.grid__1 {
background-color: #ccc;
grid-column: 1 / 2;
padding: 5px;
font-size: 1rem;
}
.grid__item {
grid-column: span 1;
grid-row: span 2;
}
<div class="grid">
<div class="box grid__1">head</div>
<div class="box grid__item">1</div>
<div class="box grid__item">2</div>
<div class="box grid__item">3</div>
<div class="box grid__item">4</div>
<div class="box grid__item">5</div>
<div class="box grid__item">6</div>
</div>
I made a live example here : https://jsfiddle.net/rLpqt75d/3/