【发布时间】:2017-07-16 00:40:25
【问题描述】:
在这个例子中,当屏幕宽度较小时,我希望蓝色和红色框可以换行,因为青色框设置为 flex-wrap。
但是,这并没有发生。为什么这不起作用?
代码如下:
.foo,
.foo1,
.foo3 {
color: #333;
text-align: center;
padding: 1em;
background: #ffea61;
box-shadow: 0 0 0.5em #999;
display: flex;
}
.foo1 {
background: green;
width: 200px;
flex: 1 1 100%;
}
.foo2 {
background: pink;
display: flex;
padding: 10px;
}
.foo3 {
background: cyan;
flex-wrap: wrap;
}
.bar1,
.bar2 {
background: blue;
width: 50px;
height: 30px;
}
.bar2 {
background: red;
}
.column {
display: flex;
flex-direction: column;
flex-wrap: wrap;
background: orange;
height: 150px;
}
<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>
详情请看以下链接:http://codepen.io/anon/pen/vxExjL
【问题讨论】: