I use the following CSS to get a quick two-column layout. divit has a static width on the left, and divfills the remaining free space on the right:
.container {
display: flex;
}
.left-column {
width: 100px;
background-color: red;
}
.right-column {
width: calc(100% - 100px);
background-color: cyan;
}
<div class="container">
<div class="left-column">
Lorum ipsum
</div>
<div class="right-column">
Lorum ipsum
</div>
</div>
Run codeHide resultIt works as I expect. However, I do not use the property flexto perform this effect in any of my children divs. Is this an idiomatic, clean way to execute my two-column layout, or should I avoid using display: flexwithout using additional flexbox features?
Kevin source
share