【发布时间】:2013-10-19 10:24:58
【问题描述】:
本例中的 LHS flex child 有 1em 填充,这会导致 RHS 溢出 parent:
<div style="display: -ms-flexbox; box-sizing: border-box; width: 200px; border: 5px solid black">
<div style="padding: 1em; -ms-flex-positive: 0; -ms-flex-negative: 0; -ms-flex-preferred-size: 33%; background-color: blue; box-sizing: border-box">
LHS
</div>
<div style="-ms-flex-positive: 0; -ms-flex-negative: 0; -ms-flex-preferred-size: 67%; background-color: red; box-sizing: border-box">
RHS
</div>
</div>
这是小提琴:
当 flex 子级有填充时,如何消除溢出? box-sizing: border-box 不起作用。
【问题讨论】:
-
您实际上可以通过在 CSS 中使用“宽度”来解决此问题。但是“高度”不适用于列弯曲。这是原始小提琴的专栏版本:jsfiddle.net/GY4F4/7
标签: css flexbox internet-explorer-11 internet-explorer-10