flexbox max-width和IE

时间:2018-03-25 01:46:28

标签: html css css3 internet-explorer flexbox

我使用flexbox,如下所示max-width。此代码适用于Google Chrome并提供结果:

enter image description here

但它在Internet Explorer中删除错误并将其显示在一行:

enter image description here

我不知道max-width有什么问题,我该如何解决这个问题......有些人会帮忙!



.d1 {
  background: blue;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 500px;
}

<div class="d1">
  A Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test B
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

flex-flow: row wrap;align-items: center一起使用,或者在flex-flow: column wrap;通话时使用justify-content: center;

检查我的代码是否正常工作。

&#13;
&#13;
<!DOCTYPE html>
<html>

<head>
  <style>
    .d1 {
    color: #fff;
      background: blue;
      display: flex;
      flex-flow: column wrap;
      justify-content: center;
      max-width: 500px;
    }
  </style>
</head>

<body>

  <div class="d1">
    A Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test B
  </div>

</body>

</html>
&#13;
&#13;
&#13;