Forums

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

Home Forums CSS [Solved] fully stretch a container vertically

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #192452
    spz1st
    Participant

    Hello, here is a problem I’m always struggling with.

    Say I have a page with a header on the top and a footer at the bottom, both with specified height. Between the header and footer is a container for the page content. What I want to achieve is to, without using javascript, have the container stretched vertically to fill the space between the header and footer if the content of the container is shorter than the window height minus the header and footer. That is, to have the min-height of the container always be the height of the space between the header and footer (it would grow or shrink along with the window resizing). Of course, if the height of the container is taller than the window height minus the header and footer, the footer should be pushed off the bottom of the window (and the page will be scrollable vertically).

    #192454
    shaneisme
    Participant

    I believe you’re looking for a “Sticky Footer”.

    You can do searches for it, some frameworks have it built in, but this is an example here: https://css-tricks.com/snippets/css/sticky-footer/

    #192464
    spz1st
    Participant

    Thanks, shaneisme.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.