【发布时间】:2020-09-12 22:46:11
【问题描述】:
在 IE11 和 Google Chrome 中查看以下代码示例。
在 Chrome 中,它按我的预期显示,但在 IE11 中,表格扩展得比包含块宽得多。这似乎是由 display: flex 引起的 - 删除 display、flex-direction 和 justify-content 样式会使所有内容弹回原位。
我希望 IE11 以与 Google Chrome 相同的方式显示我的内容。如果可能的话,我强烈希望不需要更改标记。
我遇到了许多其他处理与 IE 相关的 flexbox 错误的问题,他们都建议更改各种 flex 属性,但我没有尝试过改变效果。在div.flex * 上设置max-width 确实有效,但如果可能的话,我宁愿保持这种动态。
<html>
<body>
<style>
div.wrapper {
background-color: lightgrey;
width: 500px;
}
div.flex {
border: 1px solid blue;
display: flex;
flex-direction: column;
justify-content: center;
}
table.wrapper-table div.flex {
border: 1px solid green;
}
</style>
<div class="wrapper">
<div class="flex">
<p>This is some text that is quite a lot longer than the width of the content and therefore must wrap around to new lines</p>
<p>This is some text that is quite a lot longer than the width of the content and therefore must wrap around to new lines</p>
</div>
<table class="wrapper-table">
<tbody>
<tr>
<td>
<div class="flex">
<p>This is some text that is quite a lot longer than the width of the content and therefore must wrap around to new lines</p>
<p>This is some text that is quite a lot longer than the width of the content and therefore must wrap around to new lines</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
【问题讨论】:
标签: html css flexbox internet-explorer-11