显示:flex 不适用于 Internet Explorer [英] display: flex not working on Internet Explorer
问题描述
我的弹性容器:
.back_pattern {显示:弹性;显示:-ms-flexbox;-ms-flex-pack:居中;弹性方向:列;对齐内容:居中;对齐内容:居中;最小高度:100vh;宽度:100%;}
在其他浏览器上一切正常.
ie11 : 截取自 caniuse.com
注意事项
Internet Explorer 10 之前不支持 Flexbox,而 IE 11 只支持 2012 语法.
已知问题
- IE 11 要求将一个单位添加到第三个参数中,flex-basis 属性请参阅 MSFT 文档.
- 在 IE10 和 IE11 中,如果容器具有
min,带有
但没有明确的display: flex
和flex-direction: column
的容器将无法正确计算其伸缩子项的大小-heightheight
属性.查看错误. - 在 IE10 中,
flex
的默认值是0 0 auto
而不是最新规范中定义的0 1 auto
. - 使用
min-height
时,IE 11 无法正确垂直对齐项目.查看错误.
解决方法
Flexbugs 是社区策划的 Flexbox 问题列表以及针对这些问题的跨浏览器解决方法.以下是所有错误的列表,其中包含可用的解决方法以及影响的浏览器.
- 不遵守弹性项目的最小内容大小
- 设置为
align-items: center
的列弹性项目会溢出它们的容器 弹性容器上的 min-height
不适用于它的弹性项目flex
带有无单位flex-basis
的简写声明代码>值被忽略- 列
flex
项并不总是保持固有的纵横比一个> - 默认 flex 值已更改
flex-basis
不考虑box-尺寸:边框框
flex-basis
不支持calc()
- 某些 HTML 元素不能是 flex 容器
align-items: baseline
不适用于嵌套的 flex 容器- 包装弹性项目时忽略最小和最大尺寸声明
- 内联元素不被视为弹性项目
- 在使用 flex 速记时忽略 flex-basis 的重要性
- 使用
flex-flow: column wrap
收缩以适应容器不包含他们的项目 - 列弹性项目忽略横轴上的
margin: auto
一个> flex-basis
不能动画- 使用
max-width
时,Flex 项目没有正确对齐
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?
Internet Explorer doesn't fully support Flexbox due to:
Partial support is due to large amount of bugs present (see known issues).
Screenshot and infos taken from caniuse.com
Notes
Internet Explorer before 10 doesn't support Flexbox, while IE 11 only supports the 2012 syntax.
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: flex
andflex-direction: column
will not properly calculate their flexed childrens' sizes if the container hasmin-height
but no explicitheight
property. See bug. - In IE10 the default value for
flex
is0 0 auto
rather than0 1 auto
as defined in the latest spec. - IE 11 does not vertically align items correctly when
min-height
is used. See bug.
Workarounds
Flexbugs is 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.
- Minimum content sizing of flex items not honored
- Column flex items set to
align-items: center
overflow their container min-height
on a flex container won't apply to its flex itemsflex
shorthand declarations with unitlessflex-basis
values are ignored- Column
flex
items don't always preserve intrinsic aspect ratios - The default flex value has changed
flex-basis
doesn't account forbox-sizing: border-box
flex-basis
doesn't supportcalc()
- Some HTML elements can't be flex containers
align-items: baseline
doesn't work with nested flex containers- Min and max size declarations are ignored when wrapping flex items
- Inline elements are not treated as flex-items
- Importance is ignored on flex-basis when using flex shorthand
- Shrink-to-fit containers with
flex-flow: column wrap
do not contain their items - Column flex items ignore
margin: auto
on the cross axis flex-basis
cannot be animated- Flex items are not correctly justified when
max-width
is used
这篇关于显示:flex 不适用于 Internet Explorer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!