美文网首页
css设置body高度为浏览器的高度

css设置body高度为浏览器的高度

作者: null_su | 来源:发表于2017-08-28 22:08 被阅读0次

css设置body高度为浏览器的高度

Try setting the height of the html element to 100% as well.

html, 
body {
    height: 100%;
}

Body looks to its parent (HTML) for how to scale the dynamic property, so the HTML element needs to have it's height set as well.

However the content of body will probably need to change dynamically. Setting min-height to 100% will accomplish this goal.

html {
  height: 100%;
}
body {
  min-height: 100%;
}

from Stack Overflow

相关文章

网友评论

      本文标题:css设置body高度为浏览器的高度

      本文链接:https://www.haomeiwen.com/subject/jfkndxtx.html