所以我有一個HTML結構這樣CSS度100%的高度問題
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#container {
height: 100%;
min-width: 900px;
min-height: 650px;
background: #dddbd9 url('../images/bg.jpg') no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
overflow: hidden;
}
#content {
clear: both;
height: 345px;
position: relative;
margin: 0 auto;
width: 790px;
padding: 20px;
overflow: hidden;
}
#bottomBar {
height: 100%;
margin: 0 auto;
width: 100%;
padding: 0px;
background: #ffffff url('../images/bottomBG.jpg') 0 0 repeat-x;
}
<body>
<div id="container">
<div id="content"></div>
<div id="bottomBar"></div>
</div>
</body>
爲什麼#bottomBar
高度一直延伸超過幾百個像素以上,而背景圖片僅僅是大約115px?
更新:我其實不想bottomBar
只是115.我希望它佔據底部的整個剩餘區域,但不能超過窗口。謝謝。
UPDATE2:所以#content
爲345px,#container
是100%,其實還有一些其他的div的內容和bottomBar
之間,我怎麼了#bottomBar
剩下的高度?我想bottomBar
只佔據剩餘的區域。
您希望#bottomBar的高度與背景圖片的高度相匹配嗎?如果是這樣的話,你需要'height:115px'。 – jmar777
你在問什麼?你想讓你的'#content'達到100%的高度,'#bottomBar'具有固定的高度嗎?你想讓它成爲另一種方式嗎?你想讓它變得流暢嗎?我無法理解你想達到的目標。 – Nightfirecat
bg圖像是我想要佔據窗口底部的radien,而不僅僅是115px。謝謝。 – randomor