html - flexbox 最大宽度和 IE

标签 html css internet-explorer flexbox

我使用了一个 flexbox,如下所示,带有 max-width。此代码适用于谷歌浏览器并给出结果:

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>

最佳答案

使用 flex-flow: row wrap;align-items: center 或者你使用 flex-flow: column wrap; justify-content: center; 你的电话。

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

<!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>

关于html - flexbox 最大宽度和 IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49471744/

相关文章:

javascript - 如何使用 getJSON 从 JSON 对象将数据输出为 HTML

php - 为什么 php 回显图像只显示图像的缩略图?

html - 如何使输入字段顶部的图标响应

javascript - 垂直堆叠的动态网格布局

javascript - 在 Internet Explorer 11 中加载巨大的数组导致堆栈溢出

javascript - 拒绝访问 IE 上的 jQuery 脚本

html - 如何使用反向代理绕过 X-Frame-Options : SAMEORIGIN for iframe

php - 这些值未发布到数据库

html - 显示相对于另一个调整大小的图像的图像

javascript - Internet Explorer 闪烁问题