Is there a way to collapse the empty "col" divs in this html structure while keeping the content divs equally sized (two columns in this case)?
* {
box-sizing: border-box;
}
.container {
border: 1px dashed rgba(255, 0, 0, .5);
background-color: beige;
padding: 20px 10px;
width: 500px;
}
.row {
border: 1px dashed rgba(0, 0, 255, .5);
display: flex;
}
.col {
flex: 1 1 auto;
min-width: 0;
}
.content {
border: 1px dashed rgba(0, 0, 0, .25);
padding: 0 10px;
width: 100%;
}
<section class="container">
<div class="row">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col">
<p class="content">Foo</p>
</div>
<div class="col"></div>
<div class="col">
<p class="content">Bar</p>
</div>
<div class="col"></div>
</div>
</section>