这个问题与这个How to fill the the available height on screen with the div for any height?有关
如何在 100% 高度 div 中始终将背景图像保持在底部? 我只想显示背景图片的特定部分?
最佳答案
Try this :
html:
<div id='a'>
<div id='b'></div>
</div>
CSS:
#a, html, body{
height: 100%;
}
#a {
width: 300px;
background-color: #dde;
border: 1px solid #99c;
position:relative;
overflow: hidden
}
#b {
width: 50px;
height: 50px;
background-color: #99c;
border: 1px solid #54a;
position: absolute;
bottom: -25px;
left: 125px;
}
您需要将 bg 图像实际添加到 b
。
关于javascript - 如何在 100% 高度 div 中始终将背景图像保持在底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7150034/