This may be a bug with a column wrap
flex container. The cyan box is refusing to shrink, which prevents the red box from wrapping.
You could set a width to the second column or .foo2
or .foo3
, and that will force the items to wrap. But that's probably not what you want.
One workaround is to not use column wrap
in this case. Stick to row nowrap
:
.column {
display: flex;
background: orange;
height: 150px;
}
.foo,
.foo1,
.foo3 {
display: flex;
justify-content: center;
color: #333;
text-align: center;
padding: 1em;
background: #ffea61;
box-shadow: 0 0 0.5em #999;
}
.foo {
flex: 1;
}
.foo1 {
flex: 0 0 200px;
background: green;
}
.foo2 {
display: flex;
background: pink;
padding: 10px;
}
.foo3 {
flex-wrap: wrap;
margin: 0 auto;
background: cyan;
}
.bar1,
.bar2 {
background: blue;
width: 50px;
height: 30px;
}
.bar2 {
background: red;
}
<div class="column">
<div class="foo1"></div>
<div class="foo">
<div class="foo2">
<div class="foo3">
<div class="bar1"></div>
<div class="bar2"></div>
</div>
</div>
</div>
<div class="foo1"></div>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…