頭部... 內容內容內容內容內容內容 底部。。。 .HolyGrail { display: flex; min-height: 100vh; flex-direction: column; } header, footer { height:80px; line-height: 80px; tex... ...
<section class="HolyGrail">
<header>頭部...</header>
<div class="HolyGrail-body" style="background:url('static/images/back.jpg') no-repeat center center;
background-size:100% 100%;">
<div>內容內容內容內容內容內容</div>
</div>
<footer>底部。。。</footer>
</section>
.HolyGrail { display: flex; min-height: 100vh; flex-direction: column; } header, footer { height:80px; line-height: 80px; text-align:center; background-color:#000; color:#fff; } .HolyGrail-body { display: flex; flex: 1; align-items: center; } .HolyGrail-body div{ padding:35px 40px; margin:auto; border-radius:6px; background-color:rgba(255,235,255,0.6); } @media (max-width: 768px) { .HolyGrail-body { flex-direction: column; flex: 1; } .HolyGrail-nav, .HolyGrail-ads, .HolyGrail-content { flex: auto; } }