在flexbox上,封装工作在高度上

时间:2017-03-27 07:38:06

标签: css html5 css3 flexbox

我需要将项目放在列中,当窗口变窄时,此列会突破到新列,我可以在flexbox中执行此操作吗?

1 个答案:

答案 0 :(得分:0)



.flex-container {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap:wrap;
    width: 400px;
    height: 250px;
    background-color: #ccc;
}

.flex-item {
    background-color: #050;
    width: 150px;
    height: 300px;
    margin: 10px;
}

<div class="flex-container">
  <div class="flex-item">flex item 1</div>
  <div class="flex-item">flex item 2</div>
  <div class="flex-item">flex item 3</div>  
</div>
&#13;
&#13;
&#13;