【发布时间】:2021-05-03 18:20:48
【问题描述】:
显然,您只能在 flex 项目容器中包含块元素(内联、内联块、浮动无效)?这很奇怪,除非我做错了,否则似乎没有用?
这是笔:http://codepen.io/iaezzy/pen/GggVxe
.fill-height-or-more {
min-height: 100%;
display: flex;
flex-direction: column;
}
.fill-height-or-more > div {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
您可能必须增加预览窗格的高度才能使弹性框正常工作。
为清楚起见进行了编辑:我不是在谈论弹性项目本身,而是在弹性项目内部的元素。在上面的 codepen 中,你会看到 h2 和 p 有边框,它们有 float 声明,但不浮动。
【问题讨论】: