I hope every grid item should fit to its content width(400px), and keep the auto-fill. how can i do that?
body {
margin: 0px;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, auto));
grid-gap: 10px;
width: 100%;
}
<div class="container">
<div style="background: aqua; height: 100px;">
<div style="width: 400px; height: 100px;"></div>
</div>
<div style="background: aqua; height: 100px;">
<div style="width: 400px; height: 100px;"></div>
</div>
<div style="background: aqua; height: 100px;">
<div style="width: 400px; height: 100px;"></div>
</div>
<div style="background: aqua; height: 100px;">
<div style="width: 400px; height: 100px;"></div>
</div>
<div style="background: aqua; height: 100px;">
<div style="width: 400px; height: 100px;"></div>
</div>
</div>