1
시안 상자가 플렉스 랩으로 설정되어 있기 때문에이 예제에서 화면 너비가 작은 경우 파란색 상자와 빨간색 상자가 줄 바꿈 될 것으로 예상됩니다.중첩 된 플렉스 컨테이너에서 플렉스 랩이 작동하지 않습니다.
그러나 그런 일은 일어나지 않습니다. 왜 이것이 작동하지 않습니까?
.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
감사합니다! 이 작동합니다. 나는 이것을 정답으로 받아 들였다. 내 실제 문제는 이것보다 복잡하고 flex-dir : column을 사용해야한다. 필자의 경우 flex-dir : 행 솔루션이 작동하지 않습니다. 하지만 이것은 좋은 대답입니다! 감사! –
@ louis.luo, 당신이 이미 알고있는 경우를 대비해서, 단지 '열 감싸기 (column wrap)'에 독특한 몇 가지 플렉스 박스 문제가있다. 나는 개인적으로 '칼럼 랩 (column wrap)'이 황금 시간대에 준비되어 있다고 생각하지 않는다. 이것이 내가 보통 행 기반의 레이아웃에 충실하는 이유 중 하나입니다. –
자세한 내용은 다음을 참조하십시오 : [** 여기 **] (http://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-growits- 너비), [** 여기 **] (http://stackoverflow.com/questions/39095473/flexbox-wrong-width-calculation-when-flex-direction-column-flex-wrap-wrap), [** 여기에 **] (http://stackoverflow.com/questions/39617628/height-of-flex-container-not-working-properly-in-safari) 및 [** 여기 **] (http://stackoverflow.com/questions/34480760/the-it-possible-for-a-flexbox-container-wraps-in-rows-to-align)이 가능합니다. –