一、圣杯布局图解
二、实战项目
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>圣杯布局——简单版</title>
</head>
<style>
.HolyGrail{
display: flex;
flex-direction: column;
min-height:96vh ;
background-color: beige;
}
.header,.footer{
flex:1;
background-color: gainsboro;
line-height: 11vh;
text-align: center;
}
.HolyGrail-body{
background-color: blue;
display: flex;
flex: 1;
}
.HolyGrail-nav,.HolyGrail-ads{
flex:0 0 12em;
background-color: aquamarine;
}
.HolyGrail-content{
background-color: blueviolet;
text-align: center;
line-height:75vh;
flex:1;
}
.HolyGrail-nav{
order:-1;
background-color: pink;
}
</style>
<body>
<div class="HolyGrail">
<header class="header">头部导航栏</header>
<div class="HolyGrail-body">
<main class="HolyGrail-content">主体结构</main>
<nav class="HolyGrail-nav">nav内容</nav>
<aside class="HolyGrail-ads">侧边栏</aside>
</div>
<footer class="footer">尾部导航栏</footer>
</div>
</body>
</html>
三、效果展示