【问题标题】:Flex wrap does not working in td tag in IE11Flex wrap 在 IE11 的 td 标签中不起作用
【发布时间】:2021-07-10 07:00:13
【问题描述】:

此标记在 Chrome 中按预期工作。我可以使用 css 使其在 IE11 中工作吗?

    <table width="100%">
    <tr>
        <td>
            <div style="display: flex;justify-content: space-around;flex-wrap: wrap;">
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
            </div>
        </td>
    </tr>
</table>

【问题讨论】:

标签: css internet-explorer flexbox


【解决方案1】:

Internet Explorer 11 有时希望有明确的 width 值。所以我们可以改用display: grid

一个例子:

td > div >{   
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 100px minmax(200px, 500px) 1fr;
    grid-template-columns: 100px minmax(200px, 500px) 1fr;
}
<table width="100%">
    <tr>
        <td >
              <div>
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
                <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" controls width=250 height=150></video>
            </div>
        </td>
    </tr>
</table>

【讨论】:

  • 不工作,我怀疑是因为 td 标签。
  • @DenisMalakhov 尝试添加到td 标签,如&lt;td style="width: 100%"&gt;
  • @DenisMalakhov 或&lt;div style="display: flex;justify-content: space-around;flex-wrap: wrap;align-items: stretch;"&gt;
  • 不工作。我猜 IE 不能在 td 中处理 flex-wrap。看起来像一个错误。
  • @DenisMalakhov 如果符合条件,请尝试使用dispaly: grid。请看我更新的答案。它有效
猜你喜欢
  • 1970-01-01
  • 2018-08-05
  • 2020-11-23
  • 2017-07-16
  • 2019-04-05
  • 2023-03-09
  • 2015-12-01
  • 2018-12-10
  • 1970-01-01
相关资源
最近更新 更多