Note, that sticky footer falls short in Opera and IE8. Open the page in each, have your browser window halfway open, now drag the window down, now see that the footer does not follow. This one works in all… http://www.visibilityinherit.com/code/sticky-footer.php
I am trying to remove the footer of my WordPress.com blog, and was wondering if there was anyway to do so without having to purchase the css upgrade, and if so what the code’s would be. I am new to the whole wordpress thing, and know little to nothing about coding. Please help!
Great snippet. I will be using this all the time.
But I had a problem of large background images on the body disappearing further down the page once you scrolled.
Solution:
add overflow: auto to the second line in the CSS.
@Michael Ware: That works great! I had a basic sticky-footer setup, a repeating bg-image in the <HTML> element, and a fixed bg-image in my <BODY> element. I was having the same issue/bug where the <BODY> bg-image cut-off at the browser viewport bottom. Adding “overflow: auto” to the <BODY> element fixed this bug, but do you know if it works (and doesn’t cause other problems) on other browsers?
Great Post! but…
I tried to implement it on my own website, but it seems that the negative margin value isn’t working for me. Althoug the content isnt very high.
It positions my footer exactly “by the height of my footer” below the viewport.
Could anyone help me out. It would be greatly appreciated!
The simplest and most compatible sticky footer I know of is Ryan Fait’s Sticky Footer. It’s been a long time since I ran across it, does anyone know if it has any problems? I have yet to run across anything.
I’ve tried to glue a megamenu into the header without any success, it seems to break the ability for the footer to float correctly anymore… Any Suggestions?
Hey, I’m getting a bug with this method in google chrome (windows), although it could just be my computer. When I resize the window until a scrollbar shows, refresh the page, and then maximize, the footer jumps to the base of the content. This bug is showing on cssstickyfooter.com, and anywhere else using this method. Any ideas on a fix for this?
I’m sorry, but this didn’t work for me… I had to apply position:fixed and bottom:0 to my footer to let it work, without any of the code put here. However, perhaps it’s ’cause I was trying to use it in DotNetNuke. Works kinda differently with preset styles and such, probably. But hey, this got me going, so thanks anyway ;D
I am applying the technique of Styck footer on my site, but my content needs to be aligned both horizontally as vertically in the #main. But due to the “botom padding-bottom: 180px” when this must be the same size of the footer, my #main does not line up vertically. If I take off this padding, and put some value at the #main height , this works!, but my footer is not always at the bottom. How should I proceed in this case? I need some help!!
If you add box-sizing: border-box; to #main, it will draw the padding-bottom into the height of #main. This solved an issue I had with giving #main a height of 100%.
I’m confused as to why you can’t just set the footer to position: fixed? It seems to me that it would be a whole lot easier to accomplish it this way. Does it not work in IE or something?
Note that this clearfix is the only one with a dot (content: “.”;) instead of a space like in the “Force Element To Self-Clear it’s Children” snippet.
Very neat, I’ll test this in my code.
Note that setting html {height:100%} causes a bug where a bottom-aligned body background image will fail to attach to the real bottom of the body.
Instead it will attach to the bottom of the viewport and scroll up showing ugly space underneath.
The solution is to apply your background to an inner element or maybe your design will work with background-attachment:fixed instead.
Another brilliant bit of code from you Chris, thanks
Note, that sticky footer falls short in Opera and IE8. Open the page in each, have your browser window halfway open, now drag the window down, now see that the footer does not follow. This one works in all… http://www.visibilityinherit.com/code/sticky-footer.php
What is the code that you used for the main menu of snippets?
CSS
HTML
HTAccess
Etc.
A demo would have been better.
@iTechRoom
http://css-tricks.com/sticky-footer/
I am trying to remove the footer of my WordPress.com blog, and was wondering if there was anyway to do so without having to purchase the css upgrade, and if so what the code’s would be. I am new to the whole wordpress thing, and know little to nothing about coding. Please help!
remove the php call to get the footer?
Remove this line at the bottom of your index.php or pages.php (et al).
PHP not showing.
Here it is again. Removed the “” at the end.
?php get_footer(); ?
what the heck is this for :
body (&rt;'s) #wrap {height: auto; min-height: 100%;}
I am used THIS tricks on my project web site so is very use full me this tricks
I am a B.C.A. Student in gujarat FROM india
Thanks CSS-tricks
i am work today in microsoft 2008
and i am creat a web site in this tolds
so how many command is use full me
on CSS
I’ve been using something like this for years.
Is there a better way to do this now with css3?
this is what i’m looking for.. thanx
hi,
thank you for the code,but I’ve got a problem with firefox (mac-osx).
Does anybody have the same problem??
OPS! I was wrong… there was a comment in html code that disturb in firefox, I’ve deleted it, now it’s ok.
Thank you indeed, great article!!
Thank you! It worked well on my project website.
Great snippet. I will be using this all the time.
But I had a problem of large background images on the body disappearing further down the page once you scrolled.
Solution:
add overflow: auto to the second line in the CSS.
html, body, #wrap {
height: 100%;
overflow: auto;
}
@Michael Ware: That works great! I had a basic sticky-footer setup, a repeating bg-image in the <HTML> element, and a fixed bg-image in my <BODY> element. I was having the same issue/bug where the <BODY> bg-image cut-off at the browser viewport bottom. Adding “overflow: auto” to the <BODY> element fixed this bug, but do you know if it works (and doesn’t cause other problems) on other browsers?
Great Post! but…
I tried to implement it on my own website, but it seems that the negative margin value isn’t working for me. Althoug the content isnt very high.
It positions my footer exactly “by the height of my footer” below the viewport.
Could anyone help me out. It would be greatly appreciated!
Cheers Sam
The simplest and most compatible sticky footer I know of is Ryan Fait’s Sticky Footer. It’s been a long time since I ran across it, does anyone know if it has any problems? I have yet to run across anything.
Most of sites don’t ever need sticky footer, because all pages are taller than one screen. Always.
Hi guys,
I’ve tried to glue a megamenu into the header without any success, it seems to break the ability for the footer to float correctly anymore… Any Suggestions?
Hi Guys,
How would I get this to work in HTML5, wouldn’t this conflict with the CSS in the boilerplate? or would I just put the code in the authors section?
I’ve answered my own question… Genius, the guy’s have thought of everything, I take my hat off to Paul Irish and the rest of the team.
i like! works great!
Thanks.
George
Really like this one!
I’m not pretty sure, but I think that
#wrap should have margin-bottom with value of #footer height :S
Thanks, but I’m having issues in Firefox with this Snippet :/
Great tutorial – thanks!
Variable height sticky footer: http://pixelsvsbytes.com/blog/2011/09/sticky-css-footers-the-flexible-way/
Looks promising. Anyone tested this?
This is awesome, definitely a simplified version of what Matthew James Taylor came up with. Thanks for sharing.
Hey, I’m getting a bug with this method in google chrome (windows), although it could just be my computer. When I resize the window until a scrollbar shows, refresh the page, and then maximize, the footer jumps to the base of the content. This bug is showing on cssstickyfooter.com, and anywhere else using this method. Any ideas on a fix for this?
I’m sorry, but this didn’t work for me… I had to apply position:fixed and bottom:0 to my footer to let it work, without any of the code put here. However, perhaps it’s ’cause I was trying to use it in DotNetNuke. Works kinda differently with preset styles and such, probably. But hey, this got me going, so thanks anyway ;D
Thanks for this solution! My footer was pretty stubborn.
I am applying the technique of Styck footer on my site, but my content needs to be aligned both horizontally as vertically in the #main. But due to the “botom padding-bottom: 180px” when this must be the same size of the footer, my #main does not line up vertically. If I take off this padding, and put some value at the #main height , this works!, but my footer is not always at the bottom. How should I proceed in this case? I need some help!!
It worked! Thanks for the trick :)
You should upload demo on your this tutorial, it will helpful.
It would be great have a demo, thx!
If you add box-sizing: border-box; to #main, it will draw the padding-bottom into the height of #main. This solved an issue I had with giving #main a height of 100%.
Thanks this was a big help!
I appreciate the help.
How about James Dean’s sticky footer trick? It’s very neat, no special markup needed. It’s all done with CSS. Check it out: http://mystrd.at/modern-clean-css-sticky-footer
I’m confused as to why you can’t just set the footer to position: fixed? It seems to me that it would be a whole lot easier to accomplish it this way. Does it not work in IE or something?
Sometimes you need the footer to remain in the flow, for example when dealing with backgrounds on the main section.
Here’s some nice SASS to use with this :)