With the example below, when the CSS grid is resized, cells placed on a single column are not cropped. Which means that the min width of the column egals the min width of the cell.
This is the behavior I want.
My problem is when a cell is placed on several columns (span> 1). The columns are resized as if they did not contain anything.
.grid{
display:grid;
background:yellow;
}
.item{
background:red;
font-size:25pt;
border: solid 1px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
padding: 0 4px;
}
<div class="grid" style="grid-template-columns: repeat(16, 1fr);">
<div class="item" style="grid-column: auto / span 2;">Why</div>
<div class="item" style="grid-column: auto / span 1;">all</div>
<div class="item" style="grid-column: auto / span 2;">the</div>
<div class="item" style="grid-column: auto / span 1;">cells</div>
<div class="item" style="grid-column: auto / span 2;">with</div>
<div class="item" style="grid-column: auto / span 1;">a</div>
<div class="item" style="grid-column: auto / span 1;">span</div>
<div class="item" style="grid-column: auto / span 2;">value</div>
<div class="item" style="grid-column: auto / span 1;">over</div>
<div class="item" style="grid-column: auto / span 2;">one</div>
<div class="item" style="grid-column: auto / span 1;">shrinks?</div>
</div>
When running the code snippet, only the cells with span of 2 have its content cropped.
I don't understand why these two différents behaviors, and I'm looking for a workaround.
Note that is important to have display:grid (not flex or something else)