如何将div放在另一个div的底部?

Ban*_*hee 9 html css

如何放置adInfoBox1在容器的底部?

看看这个:http://jsfiddle.net/snowman/hxXJh/

请注意,容器的高度不固定.

Int*_*ual 16

你可以用position: absolute.

.container
{
    height: 400px;
    position: relative;
}

.adInfoBox1 {
  padding: 5px 5px 5px 10px;
  position: absolute;
  bottom: 0px;
  width: 457px;
  background-color: green;
}

.adRegularList .categoryList {
  bottom: 0;
  height: 16px;
  position: absolute;
}
Run Code Online (Sandbox Code Playgroud)

在这里查看一个工作示例:http://jsfiddle.net/hxXJh/5/


Dav*_*mas 6

我建议:

.adInfoBox1 {
    padding: 5px 5px 5px 10px;
    position: absolute;
    bottom: 0; /* attaches the element to the bottom */
    left: 0; /* attaches the element to the left-side */
    right: 0; /* attaches the element to the right-side */
    background-color : green;
}
Run Code Online (Sandbox Code Playgroud)

以上将.adInfoBox隐含地给出100% 的宽度。这可以通过删除或修改rightleft声明来调整。我删除了float因为 usingposition: absolute;无论如何都会将元素从文档流中删除。

JS小提琴演示