Internet Explorer (IE11) 忽略 CSS 内嵌:避免

Bur*_*Leo 4 html css internet-explorer internet-explorer-11

在两列框 ( column-count: 2) 中,CSS 设置break-inside: avoid应避免某些内容从一列中断到另一列。这适用于 Firefox 和 Chrome(使用适当的 -webkit... 名称),但不适用于 Internet Explorer。

这是一个例子:https : //jsfiddle.net/6s7843ue/1/

只是为了确保它不是内容中的 flexbox:https ://jsfiddle.net/6s7843ue/4/

我没有找到 IE 不支持的任何信息break-inside,恰恰相反:https : //msdn.microsoft.com/de-de/library/hh772193%28v=vs.85%29.aspx

我究竟做错了什么?谢谢!

示例代码

(另见上面的jsFiddle)

HTML

<div class="outer" style="margin: 40px auto; width: 500px; border: 1px solid #0000FF">
    <div class="container">
      This is a rather long text to break into three separate lines, but sometimes won't stay in one column
    </div>    
    <div class="container">
      Should be in next column
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.outer {
    -moz-column-count: 2;
    -webkit-column-count: 2;
    column-count: 2;
    -webkit-column-gap: 1.6em;
    -moz-column-gap: 1.6em;
    column-gap: 1.6em;
}
.container {
  border: 1px solid #AAAAAA;
  margin: 0.2em 0;
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
  align-items: center;
}
Run Code Online (Sandbox Code Playgroud)

Jav*_*lez 5

改变你的容器 display: flex 到 display:inline-flex 并且它在即:

.container {
  display: -webkit-inline-flex; /* Safari */
  display: inline-flex;
}
Run Code Online (Sandbox Code Playgroud)

https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties