html:
<body>
<div class='container'>
<header>header</header>
<main>main</main>
<aside>aside</aside>
<footer>footer</footer>
</div>
</body>
css
.container{
display: grid;
grid-template-rows: 1fr 150px 1fr;
grid-template-columns: 50px auto 50px;
height: 200px;
justify-items:center; //元素水平居中
align-item:center;
justify-content:center; //Grid整体网格水平居中
align-content:center;
}
header{
grid-row: 1;
grid-column: 1 / span 3;
background: red;
}
main{
grid-row: 2;
grid-column: 2 / span 2;
background: green;
}
aside{
grid-row: 2;
grid-column: 1;
background: yellow;
}
footer{
grid-row: 3;
grid-column: 1 / span 3;
background: blue;
}