0
我有CSS代碼做佈局。我有基本的頁眉面板,頁腳,左側面板和中央面板。我想讓左側面板和中央面板自動拉伸到底部(藍色和灰色部分一直到黑色底部)。有沒有辦法做到這一點? 以下是我的代碼。CSS佈局100%的高度延伸到底部吧
謝謝你,
body {
text-align: center;
}
.wrapper {
position: relative;
width: 960px;
font-size: 0.9em;
margin: 0 auto -20px;
text-align: left;
}
.header {
height: 125px;
background-color:purple;
}
.footer {
position: relative;
width: 960px;
margin: 0 auto;
background-color:black;
}
.footer a {
color: #fff;
text-decoration: underline;
border: 0;
}
.footer p {
position: absolute;
left: 0;
bottom: 4px;
width: 960px;
padding: 0;
color: #fff;
font: 0.8em arial,sans-serif;
text-align: center;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -20px; /* the bottom margin is the negative value of the footer's height */
background-color:yellow;
}
.footer, .push {
height: 20px; /* .push must be the same height as .footer */
}
.leftPanel{
width:200px;
background-color:blue;
float:left;
height: 100%;
}
.centerPanel{
width:760px;
background-color:gray;
float:left;
height: 100%;
}
dl,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,body,html,div,p,blockquote,fieldset,legend,input,select,textarea
{ margin:0; padding:0 }
<div class="wrapper">
<div class="header">
<h1>header</h1>
</div>
<div class="leftPanel">
leftPanel
</div>
<div class="centerPanel">
center Panel
</div>
<div class="push"></div>
</div>
<div class="footer">
<p>footer</p>
</div>
</body>
我試過的建議。但它隱藏了標題。
這是屏幕截圖 http://i.imgur.com/NxN0Z.jpg%22%20title=%22Hosted%20by%20imgur.com%22%3Ehttp://imgur.com/NxN0Z.jpg
.leftPanel { \t width:200px; \t background-color:blue; \t float:left; \t position:absolute; \t身高:100%; \t bottom:20px; \t margin-top:300px; } .centerPanel { \t width:760px; \t background-color:gray; \t position:absolute; \t身高:100%; \t margin-top:300px; \t left:200px; \t bottom:20px; } – 2010-10-28 18:55:48
我想我可能得到了錯誤的確切規則;但是這個概念站得住腳查看實際交易的添加鏈接。 – 2010-10-29 06:14:24