I would like the following layout but I am constrained by the html code. I can only change the CSS.
Column 1 has a defined width but the rows must take up the rest of the width.
+---+----------------+
| | 2 |
| |----------------+
| 1 | 3 |
| |----------------+
| | 4 |
|---|----------------+
<div class="cont">
<div class="c1">1</div>
<div class="l2">2</div>
<div class="l3">3</div>
<div class="l4">4</div>
</div>
2
Answers
It is not a task for Flexbox but CSS-Grid which can control 2 directions, unlike Flexbox.
To have 2 columns where the first column width is depending on the first element and the remaining to occupy the remaining space you can use:
grid-template-columns: auto 1fr;
.To make the first element occupy the entire first column you can use
grid-row: span {{number of rows}}
. If you do not know the number of rows or other elements then use an insanely high number that would not be reached:As already @tacoshy mentioned this can be done with grid, and you may have a look into my implementation too.