Html 显示:flex 不适用于 Internet Explorer

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43979702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 14:39:32  来源:igfitidea点击:

display: flex not working on Internet Explorer

htmlcssflexbox

提问by Oleg Verichko

My flex container:

我的弹性容器:

.back_pattern {
    display: flex;
    display: -ms-flexbox;
    -ms-flex-pack: center;
    flex-direction: column;
    align-content: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}

On other browsers everything works.
ie11 : http://take.ms/68dHo;
chrome : http://take.ms/JhcEH
What's problem?

在其他浏览器上一切正常。
ie11 : http://take.ms/68dHo;
铬:http: //take.ms/JhcEH 有
什么问题?

回答by Paolo Forgia

Internet Explorer doesn't fully support Flexboxdue to:

由于以下原因,Internet Explorer 不完全支持Flexbox

Partial support is due to large amount of bugs present (see known issues).

部分支持是由于存在大量错误(请参阅已知问题)。

enter image description hereScreenshot and infos taken from caniuse.com

在此处输入图片说明截图和信息取自caniuse.com

Notes

笔记

Internet Explorer before 10 doesn't support Flexbox, while IE 10 only supports the 2012 syntax.

Internet Explorer 10 之前不支持 Flexbox,而 IE 10 只支持2012 语法

Known issues

已知的问题

  • IE 11 requires a unit to be added to the third argument, the flex-basis property see MSFT documentation.
  • In IE10 and IE11, containers with display: flexand flex-direction: columnwill not properly calculate their flexed childrens' sizes if the container has min-heightbut no explicit heightproperty. See bug.
  • In IE10 the default value for flexis 0 0 autorather than 0 1 autoas defined in the latest spec.
  • IE 11 does not vertically align items correctly when min-heightis used. See bug.
  • IE 11 需要将一个单位添加到第三个参数中,flex-basis 属性请参阅 MSFT 文档。
  • 在 IE10 和 IE11 中,如果容器具有但没有显式属性,则具有display: flex和 的容器flex-direction: column将无法正确计算其弯曲子项的大小。请参阅错误min-heightheight
  • 在 IE10 中,默认值flex0 0 auto而不是0 1 auto最新规范中定义的。
  • 使用时 IE 11 无法正确垂直对齐项目min-height请参阅错误

Workarounds

解决方法

Flexbugsis a community-curated list of Flexbox issues and cross-browser workarounds for them. Here's a list of all the bugs with a workaround available and the browsers that affect.

Flexbugs是一个社区策划的 Flexbox 问题列表以及针对这些问题的跨浏览器解决方法。这是所有可用解决方法的错误列表以及影响的浏览器。

  1. Minimum content sizing of flex items not honored
  2. Column flex items set to align-items: centeroverflow their container
  3. min-heighton a flex container won't apply to its flex items
  4. flexshorthand declarations with unitless flex-basisvalues are ignored
  5. Column flexitems don't always preserve intrinsic aspect ratios
  6. The default flex value has changed
  7. flex-basisdoesn't account for box-sizing: border-box
  8. flex-basisdoesn't support calc()
  9. Some HTML elements can't be flex containers
  10. align-items: baselinedoesn't work with nested flex containers
  11. Min and max size declarations are ignored when wrapping flex items
  12. Inline elements are not treated as flex-items
  13. Importance is ignored on flex-basis when using flex shorthand
  14. Shrink-to-fit containers with flex-flow: column wrapdo not contain their items
  15. Column flex items ignore margin: autoon the cross axis
  16. flex-basiscannot be animated
  17. Flex items are not correctly justified when max-widthis used
  1. 不遵守弹性项目的最小内容大小
  2. 列 flex 项目设置为align-items: center溢出其容器
  3. min-height在 flex 容器上将不适用于它的 flex 项目
  4. flexflex-basis忽略具有无单位值的速记声明
  5. flex项目并不总是保持固有的纵横比
  6. 默认的 flex 值已更改
  7. flex-basis不考虑 box-sizing: border-box
  8. flex-basis不支持 calc()
  9. 一些 HTML 元素不能是 flex 容器
  10. align-items: baseline不适用于嵌套的 flex 容器
  11. 包装弹性项目时忽略最小和最大尺寸声明
  12. 内联元素不被视为弹性项目
  13. 使用 flex 速记时,基于 flex 的重要性被忽略
  14. 收缩到适合的容器flex-flow: column wrap不包含他们的项目
  15. 列 flex 项目margin: auto在横轴上忽略
  16. flex-basis不能动画
  17. Flex 项目在max-width使用时未正确对齐

回答by adeguk Loggcity

Am afraid this question has been answered a few times, Pls take a look at the following if it's related

恐怕这个问题已经回答过几次了,如果相关请看以下内容