【发布时间】:2017-08-23 19:44:53
【问题描述】:
我有一个奇怪的错误,我似乎一直在绊倒,我想知道这里到底发生了什么。我有一个带有两个子 div(flex:1)的 flexbox 容器(行换行)。当我有一个不想换行的标题时(空白:nowrap),包含 div 的 IE 11 不尊重它的宽度并缩小到小于标题宽度。这在 Chrome 中似乎工作得很好,但 Safari 和 IE 似乎不尊重标题的宽度。这是怎么回事?
这里是 js bin:https://jsbin.com/bowodiz/edit?css,output
为方便起见,我将主要样式和标记内联在下面。
HTML:
<div class="flex-container">
<div class="left">
<div class="heading">Here is a heading that shouldn't wrap</div>
<div class="sub-text">This is just some content that should wrap just fine ..</div>
</div>
<div class="right">
<div class="heading">Here is a heading that shouldn't wrap</div>
<div class="sub-text">This is just some content that should wrap just fine ...</div>
</div>
</div>
CSS(部分):
.flex-container {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
}
.flex-container > div {
flex: 1;
}
.heading {
white-space: nowrap;
}
期望:
IE/Safari 行为:
【问题讨论】:
标签: html css internet-explorer flexbox overflow