I'm learning flexbox.
I'm trying to make elements on a single row that are proportionally sized with a fixed 1:2 ratio.
.cell {
padding: 8px 16px;
}
.cell > div {
height: 30px;
}
.row {
display: flex;
}
<div class="row">
<div class="cell" style="flex: 1"><div style="background: red"></div></div>
<div class="cell" style="flex: 1"><div style="background: blue"></div></div>
<div class="cell" style="flex: 1"><div style="background: yellow"></div></div>
</div>
<div class="row">
<div class="cell" style="flex: 1"><div style="background: green"></div></div>
<div class="cell" style="flex: 2"><div style="background: purple"></div></div>
</div>
Why doesn't the flex
property achieve this?
Can this be achieved with flexbox? (It could be achieved via other means, but I'm learning how flexbox works.)