Click to See Complete Forum and Search --> : Element with maximum height


igordcard
07-30-2009, 09:17 AM
Hello, is it possible to have an element with the same height as the page? Even if the page needs scrolling?

DaiLaughing
07-31-2009, 05:34 AM
Yes. You may need to set the height of the body to 100% for when the page is shorter.

Andyram2k
07-31-2009, 04:27 PM
Hi igordcard,
Dailaughing is right, you would need to set the container to the page height. Am i right in thinking that the content would have a scroll bar, if the content grew larger than the window height? In that case, you would use overflow: auto; to achieve this:

HTML {
MIN-HEIGHT: 100%; HEIGHT: 100%; margin: 0px;
}
BODY {
MIN-HEIGHT: 100%; HEIGHT: 100%; margin: 0px;
}
HTML BODY {
MIN-HEIGHT: 100%; HEIGHT: 100%; margin: 0px;
}
#yourdiv {
height: 100%; overflow: auto; background-color: #FF0000;
}

Hope this helps.