In short, I want to have a flexible grid without using strings so that they are as dynamic as possible. The best approach I got is this:

* { box-sizing: border-box; }
.wrapper {
font-size: 0;
border: 1px solid blue;
}
.item {
font-size: 16px;
vertical-align: top;
width: 25%;
border: 2px dashed #F44336;
display: inline-block;
padding: 20px;
}
.item.c1-2 { width: 50%; }
.item.c2-3 { width: 66.66%; }
.item.c1-3 { width: 33.33%; }
<div class="wrapper">
<div class="item">One Line.</div>
<div class="item">Two<br>Lines.</div>
<div class="item">Three<br>Lines<br>Here.</div>
<div class="item">Four<br>Lines.<br><br>Yes, Really.</div>
<div class="item c2-3">Big Line.</div>
<div class="item c1-3">Small Line.</div>
<div class="item c1-2">Equal Line.</div>
<div class="item c1-2">Equal Line.</div>
</div>
Run codeHide resultWhat I missed here is that I cannot make the elements equal in height when they are on the same line so that they look like this:

Now I am looking for a solution to make them equal in height without using strings for elements. Flexbox welcomed solutions, since I do not need to support older browsers; JS solutions are fine too.
source
share