将元素锁定到包含div的底部

Wil*_*ner 28 html css

#Container {
    width: 500px;
    height: 600px;
}

#TheElement {
    width: 500px;
    height: 100px;
    background-color: #000000;
}
Run Code Online (Sandbox Code Playgroud)

如何将#TheElement锁定到#Container的最底层,无论容器内的其他内容如何,​​没有一堆边缘欺骗?

thi*_*dot 64

您可以使用相对绝对定位:

http://jsfiddle.net/gzJM6/

#Container {
    width: 500px;
    height: 600px;
    position: relative
}

#TheElement {
    width: 500px;
    height: 100px;
    background-color: #000000;
    position: absolute;
    bottom: 0;
    left: 0;
}
Run Code Online (Sandbox Code Playgroud)