这段代码在Firefox、Chrome和Edge中运行良好,但由于flex模型的问题,在IE11中无法正常工作。我该如何修复它?
以下是Firefox中的效果
以下是IE11中的效果
body * {
box-sizing: border-box;
}
html {
height: 100%;
}
body {
min-height: 100%;
display: flex;
flex-flow: column;
margin: 0;
}
main {
flex: 1;
display: flex;
}
header,
footer {
background: #7092BF;
border: solid;
width: 100%;
}
section {
border: solid;
background: #9AD9EA;
flex: 1
}
aside {
border: solid;
width: 150px;
background: #3E48CC
}
<header>
<p>header
</header>
<main>
<aside>
<p>aside
<p>aside
</aside>
<section>
<p>content
<p>content
<p>content
<p>content
</section>
</main>
<footer>
<p>footer
<p>footer
</footer>
<p>
标签(正如jmattheis已经写过的那样),2.) 你可能想在section
和aside
中的最后一个属性后添加分号。 - Johannesflex: 1;
,应该使用flex: 1 0 auto;
。 - admcfajn