方案:
>你可以使用position:absolute;来实现你的目标.和顶部:100%;
FIDDLE
>第二个选项是添加一个高度为100%的元素; “推”.内容下来FIDDLE
说明:
问题是百分比margin-top(如margin-bottom或padding-top / bottom)是根据父级的宽度计算的.见here
Percentages refer to the width of the containing block
CSS:
body,html {
background-color: lightblue;
height:100%;
width:100%;
margin:0;
}
#content {
position:absolute;
top: 100%;
background-color: lightgrey;
}
代码选项2:
HTML:
... content ...
CSS:
body,html {
background-color: lightblue;
height:100%;
width:100%;
margin:0;
}
#push{
height:100%;
}
#content {
background-color: lightgrey;
}