Is it possible to make a pure CSS solution like this:
- Items have some
min-width
. - They should grow dynamically to fill all container width and then wrap to new lines
- All items on the list should have equal width.
This is how it looks now:
And this is how I would like it too look like (I've managed those bottom items' width manually just to show the expected result):
.container {
display: flex;
flex-wrap: wrap;
}
.item {
background: yellow;
min-width: 100px;
height: 20px;
text-align: center;
border: 1px solid red;
flex-grow: 1;
}
<div class="container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
<div class="item">8</div>
<div class="item">9</div>
<div class="item">10</div>
</div>
Here is a fiddle demo.