Setting body height to 100%

I need to have the body of all my webpages (except homepage) located on http://www.zorglegal.nl to the same height (100% browser height), so the brown bar on the right is stretched full screen from top to bottom. How can I best achieve this?

html{
    height: 100%;
}

body{
    min-height: 100%;
}

doesn't work. I also tried to set a class for the content element and tried to set it to 100% height but that doesn't work either. How can i do this?

The brown bar is a png image and is set as a background image for a fullwidth container. So if that container is 100% high, it should work. But how?


You can use viewport height.

height: 100vh

This means that the div or whatever is as high as the browser window.


html, body{
    margin: 0;
    padding: 0;

    min-width: 100%;
    width: 100%;
    max-width: 100%;

    min-height: 100%;
    height: 100%;
    max-height: 100%;
}

这个Css将帮助你为每个页面设置100%的高度。


Try to achieve using javascript:

$(window).bind('resize', yourclassname);

In yourclassname also use yourID , give it to parent div.

链接地址: http://www.djcxy.com/p/89406.html

上一篇: 粘性页眉和页脚可滚动内容

下一篇: 将身高设置为100%