Just found out the new width: stretch
. This is not well standard at the time this comment was published, but I want to mention it for the future use. See https://developer.mozilla.org/en-US/docs/Web/CSS/width#stretch
.parent {
border: solid;
margin: 1rem;
display: flex;
}
.child {
background: #0999;
margin: 1rem;
}
.stretch {
width: stretch;
}
<div class="parent">
<div class="child">text</div>
</div>
<div class="parent">
<div class="child stretch">stretch</div>
</div>