I use css grid for adjusting columns and moving them to the new line when they won't fit. Here is the code that explains everything:
.tiles-container {
display: grid;
grid-gap: 6rem;
grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 2fr));
}
a {
background: red;
height: 100px;
}
<div class="tiles-container">
<a></a>
<a></a>
<a></a>
<a></a>
</div>
grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 2fr));
Now, what I want to avoid is moving just one (single) column to the new line. Instead, it breaks down earlier and moves 2 columns together.
To explain it more visually, this is what is acceptable:
█ █ █ █
also OK:
█ █ █
█ █
also OK:
█ █
█ █
and this is what is unacceptable:
█ █ █
█
I want to avoid unnecessary media queries here. Here is my code: https://jsfiddle.net/tucado/0czokyxa/3/