[Resolved] Keep the footer at the bottom on short pages

Home Forums Support [Resolved] Keep the footer at the bottom on short pages

Home Forums Support Keep the footer at the bottom on short pages

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #761101
    stairscat

    Hi,

    I’d like to have my footer at the bottom of the browser on short pages. Unfortunately, all solutions I find fix the footer to be always at the bottom, however on pages with more content it will overlap the content. I only want it to sit at the bottom when the content is too short.

    Is there a way to do this? I tried plenty of CSS but no luck so far.

    It would be cool if this feature was integrated into generatePress!

    Best regards,
    stairscat

    #761263
    David
    Staff
    Customer Support

    Hi there,

    give this a shot, although personally i would just look to fill the page πŸ™‚

    @media (min-width: 1024px) {
        body {
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
                -ms-flex-direction: column;
                    flex-direction: column;
            min-height: 100vh;
        }
        .site-footer {
            margin-top: auto;
        }
    }
    #761291
    stairscat

    Ouh yeah, it seems to work! Thanks David. πŸ™‚

    Except for one detail, the very bottom of the footer seems to be cut off. I tried playing around with your code but couldn’t figure out which part does that. I also tried playing with the padding of the footer, but no luck.

    You can see it here.

    #761367
    David
    Staff
    Customer Support

    Looks good to me on FF, Chrome and Safari, its only when the window height is low that it cuts off as the footer hits the sidebar

    #761439
    stairscat

    Okay, I know why it is, it’s because of the black Admin bar at the top. When I’m logged out, it’s perfect πŸ™‚ Thanks again David for your help and quick support.

    #761651
    David
    Staff
    Customer Support

    You’re welcome.

    #762741
    stairscat

    Actually, I have a little problem with the code. I used it on a site for another client too and noticed that the content area would become much more narrow on some pages. I tried removing the min-width, but it didn’t change anything. Any idea what it could be? Thank you. πŸ™‚

    #762757
    David
    Staff
    Customer Support

    I would need to see the Site to gauge whats causing this.

    #762771
    stairscat

    This page is the most extreme. It has become very narrow through the code (both main content box and side widgets).

    The code is active on that site.

    #762823
    David
    Staff
    Customer Support

    Yeah – it is one of the bugbears with using flex for this as the containers have an auto width on them so they resize to fit their contents. Try this:

    .container.grid-container {
        width: 100%;
    }
    #763707
    stairscat

    It worked! Thank you sir. πŸ™‚

    #763758
    David
    Staff
    Customer Support

    You’re welcome

    #818971
    Whelen Troy

    Hello David,

    Does the code above work on mobile? I tried checking my site on mobile, like iPhone X, it seems to not work.

    Can you please help me? thanks!

    #819164
    David
    Staff
    Customer Support

    The code here is within a media query so it only applies to desktops. If you wanted it on all devices then you would remove the @media (min-width: 1024px) { and the very last closing }

    #819345
    Whelen Troy

    WORKS REALLY GOOD! thanks David.

Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.