我需要使用class .gray和.yellow塊的div爲內容高度的100%,即頁眉和頁腳之間的高度爲100%。如何在div上設置100%高度?
請告訴我該怎麼做?
html,
body {
height: 100%;
margin: 0;
padding: 0;
font-family: Tahoma, Verdana, Segoe, sans-serif;
}
#page-content {
min-height: 100%;
margin-bottom: -80px;
}
#page-buffer {
height: 80px;
}
footer {
height: 80px;
background: #f00;
}
.yellow {
height: 100%;
background-color: yellow;
}
.gray {
background-color: gray;
height: 100%;
}
.blue {
background-color: blue;
}
.h100{
height: 100%;
}
<div id="page-content">
<header class="blue">
<div class="container">
<div class="row">
<div class="col-xs-12 ">
some header
</div>
</div>
</div>
</header>
<div class="container h100">
<div class="row h100">
<div class="col-sm-8 gray same">
Lorem ipsum dolor sit amet.
</div>
<div class="col-sm-4 yellow same">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi consectetur, recusandae sapiente! Beatae facilis cupiditate, a iure officiis alias quibusdam.
</div>
</div>
</div>
<div id="page-buffer"></div>
</div>
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12">
some footer
</div>
</div>
</div>
</footer>
刪除容器類 –
您需要包含所有相關代碼才能直接在問題中複製問題。不只是一個URL codepen – musefan