Return to Snippet

Revision: 52210
at October 16, 2011 09:40 by dloop


Initial Code
$(document).ready(sizeContent);
    $(window).resize(sizeContent);
    function sizeContent() {
        var newHeight = $("html").height() - $("#subtract-all-other-divs").height() + "px";
        $("#the-div-you-need-100%-height").css("height", newHeight);
}

Initial URL

                                

Initial Description
Declare html, body {height: 100%} in your css. Subtract all divs with a given height, such as a header, navigation and a footer. Like this: "#header" - "#navigation" - "#footer" + "px". Then add the element you need at 100% height.

Initial Title
Jquery: 100% Height (html, body)

Initial Tags

                                

Initial Language
jQuery