Flexbox
Using the flexbox property of css, you can better handle the fluidity you want between items. Analyze the difference of the class .content-wrap where I add a new parameter in the flex-flow property.
On the cross-browser issue of this property, it is already widespread in today's browsers. You will only need to analyze and align with your project if it will support some old browser that does not support flex-box, so you will need to analyze a fallback js to manipulate its elements and maintain the flexibility you want.
Taking this compatibility issue, everything is perfect in CSS.
I also advise you to read about this flex-box property.
link
This guide is super intuitive too.
link
I hope I have been able to help if you need help just to comment.
.box-container {
background: #ccc;
display: flex;
flex-flow: row;
align-items: center;
justify-content: space-around;
max-width: 600px;
padding: 0;
margin: 0 auto;
}
.content-wrap {
flex-flow: row wrap;
}
.box-item {
background: tomato;
border: 1px solid #fff;
color: #fff;
flex: 1 auto;
list-style: none;
padding: 20px;
margin: 0;
text-align: center;
}
<h2>Primeira lista</h2>
<ul class="box-container">
<li class="box-item">Item 1</li>
<li class="box-item">Item 2</li>
<li class="box-item">Item 3</li>
<li class="box-item">Item 4</li>
<li class="box-item">Item 5</li>
<li class="box-item">Item 6</li>
</ul>
<h2>Segunda lista</h2>
<ul class="box-container">
<li class="box-item">Item 1</li>
<li class="box-item">Item 2</li>
<li class="box-item">Item 3</li>
</ul>
<h2>Terceira lista</h2>
<ul class="box-container">
<li class="box-item">Item 1</li>
<li class="box-item">Item 2</li>
<li class="box-item">Item 3</li>
<li class="box-item">Item 4</li>
<li class="box-item">Item 5</li>
<li class="box-item">Item 6</li>
<li class="box-item">Item 7</li>
<li class="box-item">Item 8</li>
</ul>
<h2>Quarta lista com wrap</h2>
<ul class="box-container content-wrap">
<li class="box-item">Item 1</li>
<li class="box-item">Item 2</li>
<li class="box-item">Item 3</li>
<li class="box-item">Item 4</li>
<li class="box-item">Item 5</li>
<li class="box-item">Item 6</li>
<li class="box-item">Item 7</li>
<li class="box-item">Item 8</li>
<li class="box-item">Item 9</li>
<li class="box-item">Item 10</li>
</ul>
<h2>Quinta lista com wrap</h2>
<ul class="box-container content-wrap">
<li class="box-item">Item 1</li>
<li class="box-item">Item 2</li>
<li class="box-item">Item 3</li>
<li class="box-item">Item 4</li>
<li class="box-item">Item 5</li>
<li class="box-item">Item 6</li>
<li class="box-item">Item 7</li>
<li class="box-item">Item 8</li>
<li class="box-item">Item 9</li>
<li class="box-item">Item 1</li>
<li class="box-item">Item 12</li>
<li class="box-item">Item 13</li>
<li class="box-item">Item 14</li>
<li class="box-item">Item 15</li>
</ul>