Css 为什么显示:-ms flex-ms内容:中心;在IE10中不工作?

Css 为什么显示:-ms flex-ms内容:中心;在IE10中不工作?,css,internet-explorer-10,flexbox,justify,Css,Internet Explorer 10,Flexbox,Justify,为什么以下代码在IE10中不起作用 .foo{ 显示:-ms flex; -ms内容:中心; } 我需要写些什么才能让它们工作?IE10从中实现了Flexbox草案。这些属性对应于: .foo { display: -ms-flexbox; -ms-flex-pack: center; } 在尝试为所有浏览器提供正确的语法时,一个好的起点是 对于在容器中水平和垂直居中的元素,您将得到如下代码:(在Chrome、FF、Opera 12.1+和IE 10+中工作) <di

为什么以下代码在IE10中不起作用

.foo{
显示:-ms flex;
-ms内容:中心;
}

我需要写些什么才能让它们工作?

IE10从中实现了Flexbox草案。这些属性对应于:

.foo {
    display: -ms-flexbox;
    -ms-flex-pack: center;
}

在尝试为所有浏览器提供正确的语法时,一个好的起点是

对于在容器中水平和垂直居中的元素,您将得到如下代码:(在Chrome、FF、Opera 12.1+和IE 10+中工作)

<div class="flex-container">
  <div class="flex-item">A</div>
  <div class="flex-item">B</div>
  <div class="flex-item">C</div>
</div>

请展示你的html标记和css样式我认为证明内容在IE中不起作用,因为:这也是设置一系列你甚至不需要的属性的好方法。谢谢你链接到该网站。谢谢。它起作用了。因此IE使用旧语法。对于未来的搜索者:当使用Autoprefixer或手写笔提供旧语法时,我注意到一个问题,即在IE10中,设置为-ms flex:1的flexbox子项还需要一个inline block或block的显示值。因此,span元素或任何默认为display:inline的元素在flexbox布局中使用时可能无法按预期运行,除非您更改其显示设置。
.flex-container {

    height: 100%;
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-direction: normal;
    -moz-box-direction: normal;
    -webkit-box-orient: horizontal;
    -moz-box-orient: horizontal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -moz-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-align-content: stretch;
    -ms-flex-line-pack: stretch;
    align-content: stretch;
    -webkit-box-align: center;
    -moz-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    }
.flex-item
{
    width: 100px;
    height:100px;
    background: brown;
    margin: 0 10px;
}

/*
    Legacy Firefox implementation treats all flex containers
    as inline-block elements.
*/

@-moz-document url-prefix() {
.flex-container {
    width: 100%;
    -moz-box-sizing: border-box;
    }

}