所以我有一个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