, 50% cols, , , , , 25%.
JS
$('a').on('click', function(e) {
e.preventDefault();
$('.break-row').remove();
$('.row').removeClass('always-break')
var breakAfter = $(this).data('breakafter');
if (breakAfter > 0) {
$('<div class="break-row" />').insertAfter('.col:nth-child(' + breakAfter + 'n)');
if (breakAfter === 1) {
$('.row').addClass('always-break')
}
}
});
CSS
.row {
display: flex;
flex: 1 1 auto;
flex-wrap: wrap;
background: #222;
width: 500px;
height: 500px;
}
.col {
display: flex;
flex-flow: column;
flex: 1 1 auto;
min-height: 50%;
}
.row.always-break .col{
min-height: 25%;
}
.break-row {
width: 100%;
flex: 0 0 auto;
height: 0px;
}
a {
background: #456;
padding: 10px;
border-radius: 5px;
margin: 10px;
display: inline-block;
color: #fff;
}