Site logo

Archived topic

Keep the footer at the bottom on short pages

21 replies · Started by stairscat on December 19, 2018

Viewing posts 16–22 of 22

Awesome - glad to be of help.

Hi David,

Thanks for the code in this thread. It worked to get the footer to attach to the bottom of the screen for shorter, dynamic content. However, I'm having an odd issue where on the initial page load the main content block is being positioned half off the page, to the left. This is the Elementor content that's getting positioned off the page. The main nav and footer for GeneratePress is working fine.

Any ideas?

Thanks, David. I tried several things before writing here, one of which was setting the height of that section to 100vh. When I did that, the footer was always below the viewport and I had to scroll the page to see it. I'd rather have it stick to the bottom of the viewport if the content doesn't push it past that.

Would you expect this to work by just setting 100vh? It's possible I'm missing something when I used that setting.

If there isn't a good answer for the 100vh issue, can you let me know where to place the PHP code you referenced in the last response.

Thanks again.

Give the Section a class of fit-viewport then add this CSS:

.fit-viewport {
    min-height: calc( 100vh -  300px );
}

Change the 300px to total the height of header/footer etc.

That worked! In case this helps anyone else, I ended up needing to subtract the height of my header and footer, while accounting for differences across device types.

Thanks so much for your help. The support you and the rest of the GeneratePress team provides is outstanding. It really makes a difference.

You're welcome

This archived topic is closed to new replies.