I need the flex container to shrink to fit content when the items in the container wraps. The items need to be of a fixed width.
How does one do it?
Here is an example:
.wrapper {
display: flex;
border: 1px solid red;
flex-wrap: wrap;
}
.item {
height: 40px;
background-color: green;
margin: 10px;
width: 300px;
}
<div class="wrapper">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>