答案 0 :(得分:0)
你还必须为你的html添加100%的高度:
html {height:100%;}
答案 1 :(得分:0)
问题是身体边缘,只是零,你应该得到所需的布局:
body {
height:100%;
margin:0;
}
html{
height:100%;
}
#content{
height: -moz-calc(100% - 50px);
height: -webkit-calc(100% - 50px);
height:calc(100% - 50px);
background:blue;
overflow-y:scroll;
}
footer {
position:fixed;
bottom:0;
width:50%;
height:50px;
background-color:green;
}
<div id="content">fsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
afsdfsa
fsadf
as
fas
df
asdf
saf
<p>this is not last line</p>
<p>last line</p>
</div>
<footer>
i am footer
</footer>