这个
min-width:100%; width:0
对你们来说,这个把戏就行了。网格轨迹大小是根据其
width
,那么它的大小将根据赛道的大小重新增加,因为
min-width
.
body {
display: flex;
}
.grid-container {
display: grid;
gap: 20px;
grid-template-columns: auto auto auto;
.see-all {
display: grid;
grid-column-start: 1;
grid-column-end: 4;
grid-template-columns: subgrid;
:nth-child(1) {
column: 1;
}
:nth-child(2) {
column: 2;
}
:nth-child(3) {
column: 3;
}
}
.other {
grid-column: 1 / span 3;
}
.long-cell {
min-width: 100%;
width: 0;
}
}
<body>
<div class="grid-container">
<div class="see-all">
<div>Apple</div>
<div>Banana</div>
<div>Coconut</div>
</div>
<div class="see-all">
<div>Date</div>
<div>Eggplant</div>
<div>Fig</div>
</div>
<div class="other long-cell">
This row is just too long, I want to force the elements in this row to word wrap and not contribute to the grid
</div>
</div>
<body>