How to push a footer to the bottom of page when content is short or missing?

前端 未结 13 1305
囚心锁ツ
囚心锁ツ 2020-12-04 16:55

I have a page with an outer div that wraps a header, content and footer div. I want the footer div to hug the bottom of the browser, even when the content div is not tall e

13条回答
  •  眼角桃花
    2020-12-04 17:14

    Reworking the jQuery solution. I have it working with resizing the window. When the window is bigger than the page, the footer style's position is "absolute" fixed at the bottom the window. When the window is smaller than the page, the footer stays at the bottom of the page - scrolling off the bottom.

    
    

    I tried many style only solutions but none of them worked. This Javascript/Style solution works just fine for me, even with its odd mix of jQuery and GetElement.

    Thanks to Asad for his post.

提交回复
热议问题