Footer not fixed to the bottom of the page

Filip Grebowski

I tried having my footer stick to the bottom of the page, but the more content I add to my body, then it just goes out of bounds. I can't see a fault in my CSS, so hopefully one of you will be able to sort it.

.footer {
    padding-bottom: 0;
    background: gray;
    width: 100%;
    position: absolute;
    height: 50px;
    bottom: 0;
    left: 0;
    right: 0;
}

Here is a JSFiddle: https://jsfiddle.net/367apj76/

Many Thanks for the help.

Eran Shabi

Remove the position: absolute; from .footer

UPDATE:

You should put everything but the footer in a div with the following CSS:

min-height: calc(100vh - *footer-height*px);

and the footer should go right after this div.

This will work because the new div cannot be smaller than the window size minus the footer, but grows with the window (that's what vh is for).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Keep footer at the bottom of the page but not fixed

From Dev

Fixed footer that expands when scrolled to bottom of page

From Dev

Footer always fixed to the bottom of the page bootstrap?

From Dev

Fixed footer on the bottom of the page or below the text

From Dev

Fixed footer that expands when scrolled to bottom of page

From Dev

How to make a footer fixed at bottom?

From Dev

Footer floats on page and not at bottom

From Dev

Push footer to the bottom of the page

From Dev

Footer not staying at the bottom of page

From Dev

Force footer to the bottom of page

From Dev

Forced footer to the bottom of the page

From Dev

Footer is not on the bottom of the page

From Dev

Footer Not Sticking To The Bottom Of The Page

From Dev

Keep Footer At Bottom Of Page

From Dev

Fixed column, fluid content and bottom fixed footer

From Dev

Materialize footer not going to bottom of page

From Dev

Space between footer and bottom of the page

From Dev

How to add footer to the bottom of the page

From Dev

Making the footer stick at the bottom of the page

From Dev

Issue with sticky footer at the bottom of the page

From Dev

Sticking Foundation footer to the bottom of page

From Dev

Always display footer at the bottom of the page

From Dev

Push footer to bottom of page (bootstrap)

From Dev

Why is the footer not going to the bottom of the page?

From Dev

Issue with sticky footer at the bottom of the page

From Dev

Sticking Foundation footer to the bottom of page

From Dev

Always display footer at the bottom of the page

From Dev

How to keep footer at the bottom of the page

From Dev

Fix footer to bottom of page (no header)

Related Related

HotTag

Archive