Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Blank Div Not Getting 100% height why ? Re: Blank Div Not Getting 100% height why ?

#88082
Mottie
Member

There are two different ways, that I know of, to do this. As wolfcry911 said, you need to set the html/body height if you want to fill the visible page (demo).

Method 1 – padding/margins must be zero or it goes beyond screen height

html, body {
height: 100%;
padding: 0;
margin: 0;
}
div {
height: 100%;
padding: 0;
margin: 0;
}

Method 2 – padding allowed; adjust position (top, left, right, bottom) to add margin

html, body {
height: 100%;
padding: 0;
margin: 0;
}
div {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 20px;
}