Html 将div置于父div的底部

Html 将div置于父div的底部,html,css,Html,Css,我想在他的parant div的底部不断添加div元素 这应该与 position:relative; bottom:0px; 不管怎么说,我唯一能做的就是把顶部留到合适的位置,但我不喜欢这样。你能在我的代码中找到这个职位不起作用的原因吗 @charset "utf-8"; /* CSS Document */ body { background-color:#999; } #wrapper { height:40em; max-height:45em;

我想在他的parant div的底部不断添加div元素

这应该与

position:relative; 
bottom:0px;
不管怎么说,我唯一能做的就是把顶部留到合适的位置,但我不喜欢这样。你能在我的代码中找到这个职位不起作用的原因吗

@charset "utf-8";
/* CSS Document */

body {
    background-color:#999;  
}

#wrapper {
    height:40em;
    max-height:45em;
    min-height:40em;
    width:80%;
    max-width:60em;
    min-width:30em;
    margin-left:auto;
    margin-right:auto;
    background-color:#333;
    border:#000 solid;
    border-width:thin;
}

#header {
    width:100%;
    height:70px;
    background-color:#009900;
    border-bot:#000 solid;
    border-width:thin;
}

#content {
    position:relative; 
    bottom:0px;
    top:auto;
    width:100%;
    height:30em;
    background-color:#FFFFFF;
    border-top:#000 solid;
    border-width:thin;  
}

内容和头都是包装器的父级。所以我想把内容放在包装的底部。

将位置#包装设置为相对,然后将内容的位置设置为绝对,底部设置为零。

将位置#包装设置为相对,然后将#content的位置设置为绝对,将bottom设置为零。

父元素应该有一个
位置:relative
和一个粘附在底部的位置

position:absolute; 
bottom:0px;

希望这能有所帮助。

父元素应该有一个
位置:relative
和一个粘在底部的元素

position:absolute; 
bottom:0px;
希望这有帮助