我使用了一个 flexbox
,如下所示,带有 max-width
。此代码适用于谷歌浏览器并给出结果:
但它在 Internet Explorer 中存在错误,删除开始并在一行中显示它:
我不知道 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/