Having such html as in the picture on the left, is it possible to change its appearance so that it looks like in the picture on the right (the width of the first column is equal to the maximum width of the content inside it)? Without using javascriptm changing only css. And without using min-wdith, because the width of the content in the first column is unknown, the backend can send different data.
If .option elements were not wrapped in .list-item elements, it would be possible to apply display: table-cell to .option-col element and display: table-row to .option elements. But unfortunately I can't change html. Please, help.
.list {
border: 1px solid grey;
}
.option {
border: 1px solid grey;
display: flex;
gap: 16px;
}
.option-col {
color: green;
display: flex;
align-items: center;
padding: 8px;
}
.option-col + .option-col {
border-left: 1px solid red;
}
.option-col:first-child {
color: blue;
}
<div class="list">
<div class="list-item">
<div class="option">
<div class="option-col">BEN</div>
<div class="option-col">
Has been the industry's standard dummy text ever since the 1500s, when an unknown printer
took
</div>
</div>
</div>
<div class="list-item">
<div class="option">
<div class="option-col">FOOBARZ</div>
<div class="option-col">Many desktop publishing</div>
</div>
</div>
</div>
