V
V
Vlad Vladov2017-07-09 14:52:47
css
Vlad Vladov, 2017-07-09 14:52:47

How to make the height calculated according to the size of the browser window?

On the site I want to make content for the entire height of the page, and below it is a footer, but the footer crawls out (see
the gray bar screen) 7f1d8d96fecf426d8e3f754a03f880b9.png

I tried to do it through JQuery

(function () {

    $(".full-height").height($(window).height());
    $(window).resize(function(){
        $(".full-height").height($(window).height());
    });
}
}());


On large monitors, everything is fine, the footer is shown only when scrolling down, but on small displays, the footer fits over the text. How can I make the script work only on screens with a height greater than 900? Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
profesor08, 2017-07-09
@profesor08

<div class="content"></div>
<div class="footer"></div>

.content {
    height: 100vh;
}

.footer {
    height: 50px;
}

Where vh - Viewport Height

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question