How to have footer always at the bottom of page?
Asked Answered
W

4

8

My page doesn't contain a lot of information, so footer is displayed somewhere in the middle of the page. How can I have that always at the bottom?

Waste answered 24/9, 2011 at 7:19 Comment(2)
Try jsfiddle.net/9eYa8 if you mean your query is regarding HTML.Endor
Thanks, my question was about jquery mobile.Waste
W
20

jquery mobile approach - <div data-role="footer" data-position="fixed">

Waste answered 24/9, 2011 at 7:57 Comment(1)
This doesn't help me for the case when my page is longer than the mobile viewport. I would like the footer to be fixed for short content pages, but be at the very bottom of the content for longer pages, not overlayed on top of content.Kitten
S
3
{
  potition: absolute;
  bottom: 0;
  width: 100%;
  height: some_height;
}
Slush answered 24/9, 2011 at 7:25 Comment(1)
Thanks. Actually I've just found jquery mobile approach - <div data-role="footer" data-position="fixed">Waste
I
3

This isn't a fixed position footer. The footer will be offscreen if the page content is taller than the screen. I think it looks better this way.

The body and .ui-page min-height and height are necessary to prevent the footer from jumping up and down during transitions.

Works with the latest JQM version as of now, 1.4.0

body,
.ui-page {
    min-height:100% !important;
    height:auto !important;
}

.ui-content {
    margin-bottom:42px; /* HEIGHT OF YOUR FOOTER */
}

.ui-footer {
    position:absolute !important;
    width:100%;
    bottom:0;
}
Intelligibility answered 5/2, 2014 at 0:23 Comment(0)
T
0
[data-role=page]{height: 100% !important; position:relative !important;}
[data-role=footer]{bottom:0; position:absolute !important; top: auto !important; width:100%;}  
Transitive answered 8/8, 2013 at 7:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.