<分区>
#Container {
width: 500px;
height: 600px;
}
#TheElement {
width: 500px;
height: 100px;
background-color: #000000;
}
我如何让#TheElement 被锁定到#Container 的最底部,而不考虑容器内的其他内容,而没有一堆边距技巧?
<分区>
#Container {
width: 500px;
height: 600px;
}
#TheElement {
width: 500px;
height: 100px;
background-color: #000000;
}
我如何让#TheElement 被锁定到#Container 的最底部,而不考虑容器内的其他内容,而没有一堆边距技巧?
最佳答案
您可以使用 relative absolute positioning :
#Container {
width: 500px;
height: 600px;
position: relative
}
#TheElement {
width: 500px;
height: 100px;
background-color: #000000;
position: absolute;
bottom: 0;
left: 0;
}
关于html - 将元素锁定到包含 div 的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5135974/