这是一个网格作业,IE11将需要一个旧的和特定的语法,并设置网格中的每个元素(没有自动流放置可用:()
要在IE11中运行演示:
https://jsbin.com/sejazibipu/1/edit?css,output
body {
margin: 0;
}
* {
box-sizing: border-box;
}
section {
display: grid;
grid-template-columns: 3fr 4fr;
padding: 5vh;
grid-gap: 5vh;
margin: auto;
}
section > * {
border: solid;
min-height: 40vh; /* demo purpose*/
}
aside {
grid-row: auto / span 2;
}
@media (max-width: 768px) {
section {
grid-template-columns: 1fr;
grid-auto-rows: auto;
}
section > * {
grid-row: auto/ span 1;
min-height: 25vh; /* demo purpose*/
}
div:nth-child(2) {
order: -1;
}
}
/* IE */
section {
display: -ms-grid;
-ms-grid-columns: 3fr 2.5vh 4fr;
-ms-grid-rows: auto 2.5vh auto;
}
aside {
-ms-grid-row-start: 1;
-ms-grid-row-span: 3;
-ms-grid-column: 1;
}
div:nth-child(2) {
-ms-grid-row: 1;
-ms-grid-column: 3;
}
div:nth-child(3) {
-ms-grid-row: 3;
-ms-grid-column: 3;
}
@media (max-width: 768px) {
section {
-ms-grid-columns: 1fr;
-ms-grid-rows: auto 2.5vh auto 2.5vh auto;
}
section > * {
-ms-grid-row-span: 1;
min-height: 25vh; /* demo purpose*/
}
aside {
-ms-grid-row: 3;
-ms-grid-column: 1;
}
div:nth-child(2) {
-ms-grid-row: 1;
-ms-grid-column: 1;
}
div:nth-child(3) {
-ms-grid-row: 5;
-ms-grid-column: 1;
}
}
<section>
<aside> 1</aside>
<div> 2</div>
<div> 3</div>
</section>