I have a flex row with two children. Both are flex: 1
. The first child is also a flex row with two children, and both are also flex: 1
. We'll call the first child of the first child X. When the content of X exceeds half the width of the row, the X expands and makes its parent expand, ultimately taking space from the other elements. The desired behavior instead is for the content to overflow.
[[X][ ]][ ]
.r {
display: flex;
}
.container {
width: 300px;
height: 50px;
}
.x1 {
flex: 1 0 0;
}
.of {
overflow-x: auto;
}
.red {
background: #f88;
}
.blue {
background: #88f;
}
<div class='r container'>
<div class='r red x1'>
<div class='x1 of'>
Supercalifragilisticexpialidocious
</div>
<div class='x1'>
Hello
</div>
</div>
<div class='blue x1'>
</div>
</div>
I've hacked a fix using position: absolute
but is there a more elegant solution?