- This topic has 18 replies, 3 voices, and was last updated 8 years, 8 months ago by Tom.
-
AuthorPosts
-
December 8, 2014 at 10:13 am #52684Johandrex
Hello, I just bought this domain and website today.
And I wonder how to stick the footer to the bottom since there’s a gap between the bottom end and the footer.December 8, 2014 at 3:07 pm #52807TomLead DeveloperLead DeveloperThis usually only happens when the page isn’t long enough for the screen you’re using.
A solution is possible, but it requires javascript, and can be a little hacky.
There’s also some CSS hacks you can try.
You’re better off adding more content to the page if you don’t like the gap at the bottom of the screen.
http://ryanfait.com/sticky-footer/
http://www.cssstickyfooter.com/December 9, 2014 at 10:54 am #53188JohandrexNeither of those websites codes are working for me, aren’t there any way to fix this?
December 9, 2014 at 11:22 am #53195JohandrexAlright if it wouldn’t work, how do I disable the footer
December 9, 2014 at 3:20 pm #53264TomLead DeveloperLead DeveloperYou can disable the footer with this CSS:
.site-info { display: none; }
Unfortunately there’s no easy “fix” – the HTML elements stack as they should, and if the container above the footer are too short for the screen, the footer will appear before the bottom of your screen.
Let me know if you need anything else π
December 10, 2014 at 8:32 am #53566JohandrexThanks for your help!
The footer has been disabled.December 10, 2014 at 11:31 am #53624TomLead DeveloperLead DeveloperYou’re welcome π
April 29, 2015 at 9:43 pm #103966DavidI just thought I would throw this out there. As Tom mentioned, this solution is definitely hacky since I’m hardcoding several pixel offsets for headers, footers, and other formatting. As such, the values will be different for others and some may not be needed. With that said, the following CSS allowed me to force the page to take up the entire height of the window with the footer on the bottom. I haven’t spent enough time ensuring that none of the CSS is redundant or unnecessary but this was what worked for me and functions properly in all modern browsers as far as I could tell.
* { padding: 0; margin: 0; } html { height: 100%; overflow-y: auto; } body { height: 100%; min-height: 100%; } #page { height: calc(100% - 150px); overflow: hidden; width: 100%; display: table; table-layout: fixed; margin-bottom: -32px; } #content { height: 100%; width: 100%; display: table-cell; table-layout: fixed; } #primary { height: 100%; } #main { height: calc(100% - 50px); } article { height: 100%; padding-bottom: 32px; } .inside-article { height: calc(100% - 80px); } .site-footer { margin-top: -32px; height: 32px; }
April 29, 2015 at 11:13 pm #104002TomLead DeveloperLead DeveloperVery useful – thanks for posting! π
November 6, 2015 at 6:45 am #150941Tekno TeddyUsing the cssstickyfooter seemed to work nicely for me. I haven’t tested it thoroughly, but so far I do not have any issues. Adjust the height “50px” accordingly.
html, body {height: 100%;} #page {min-height: 100%;} #content {overflow:auto; padding-bottom: 50px;} /* must be same height as the footer */ .site-info {position: relative; margin-top: -50px; /* negative value of footer height */ height: 50px; clear:both;} /*Opera Fix*/ body:before { content:""; height:100%; float:left; width:0; margin-top:-32767px;/ }
Thanks!
November 6, 2015 at 6:54 am #150952Tekno TeddyI changed the height under site info to min-height. This seems to work better for me ;).
November 6, 2015 at 10:38 am #151034TomLead DeveloperLead DeveloperThanks for posting your solution! π
January 5, 2016 at 10:21 am #163488KrzysztofFor one of my sites I use that code:
html, body{ height:100%; } .site-footer{ bottom:0; position:relative; }
Everything works except sticky menu – always moves page to the top after menu show. Any ideas to fix that?
January 5, 2016 at 10:50 pm #163628TomLead DeveloperLead DeveloperInteresting, can I see?
January 6, 2016 at 1:53 am #163646Krzysztof@Tom check my site jix.im. Sticky menu is only on mobile.
-
AuthorPosts
- You must be logged in to reply to this topic.