Div不会伸展到100%的高度

时间:2015-01-14 16:47:42

标签: html css

为什么这个div不是100%高度,父母有100%和div也是!绿色应该伸展到底部!

我是否忽视了某些事情?

http://codepen.io/helloworld/pen/vExZpe

<div style="height:100%;background:green;">
  test
</div>

body, hmtl{
  height:100%;
}

div{
  height:100%;   
}

1 个答案:

答案 0 :(得分:6)

你有一个错字。 hmtl应为html

&#13;
&#13;
body, html {
  height: 100%;
}
div {
  height: 100%;
}
&#13;
<div style="height:100%;background:green;">
  test
</div>
&#13;
&#13;
&#13;