I am trying to use flexbox to create a horizontal layout for a mix of div
and svg
elements. The red and yellow (svg) boxes are pushed out of visibility when the width of the green box is increased sufficiently. However, if I wrap them in a div this doesn't happen. Why is this?
.container {
display: flex;
overflow-x: auto;
white-space: nowrap;
}
<div class="container">
<svg width="100px">
<rect width="100" height="100" fill="red" />
</svg>
<div>
<svg width="1200px">
<rect width="100" height="100" fill="green" />
</svg>
</div>
<svg width="100px">
<rect width="100" height="100" fill="yellow" />
</svg>
</div>