我有一个块网格,其中其他块也包含在弹性块中。
我遇到的问题是在顿悟中网格的弹性项目的子项中忽略了高度。它似乎与 Firefox 和铬正确显示。
我通过顿悟获得的结果是第一个块比后面的 2 个块长。在 firefox 和 chrome 上,所有块在第一行具有相同的高度,并在必要时在每行上相应地扩展。
.container {
width: 20rem;
height: 20rem;
overflow: auto;
}
.b2 {
height: 100%;
background: pink;
}
.widgets {
display: -webkit-flex;
-webkit-flex-direction: row;
-webkit-flex-wrap: wrap;
justify-content: flex-start;
align-items: stretch;
}
.widget {
margin: 1rem;
}
.box {
display: -webkit-flex;
-webkit-flex-direction: column;
-webkit-justify-content: space-between;
background: grey;
width: 4rem;
height: 100%;
overflow: hidden;
}
.r1 {
padding: 0.25rem;
}
.r2 {
padding: 0.25rem;
background: red;
color: white;
}
<div class="container">
<div class="widgets">
<div class="widget">
<div class="box">
<div class="r1">
asdasdasdasd akjsdha ksjdh askjdh askjdh asd
</div>
<div class="r2">
2
</div>
</div>
</div>
<div class="widget">
<div class="b2">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
</div>
<div class="widget">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
<div class="widget">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
<div class="widget">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
<div class="widget">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
<div class="widget">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
<div class="widget">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
<div class="widget">
<div class="box">
<div class="r1">
1
</div>
<div class="r2">
2
</div>
</div>
</div>
</div>
</div>