Yup, confirmed on my box. Could we speak of a full proof sticky footer ? :award:
Hi Eric,
As Ray said we already got rid of the IE comments and this is the fullproof version now:
http://www.pmob.co.uk/temp/sticky-footer-ie8new-no-table.htm
Your example will break in a fluid width layout because of the margin-top:-100% you are using.
Margin always refers to the width of the element and therefore if the element is say only 300px wide but the page is 600px high then there will be 300px of the float sticking down into the page. This means that any cleared elements in the content will now jump down the page to clear the float.
We removed the conditional comments a while back after the discussion in the article Ray pointed to
Apart from the margin error you have basically arrived at the same solution but instead of using after you are using before to get IE8 to recognise the 100% height.
Hi Paul
Thanks for the explanation. Alright, no biggy, I wasnât married to it. -100% was sort of temp, thats why I asked my above questions. % margin-top being based on width just doesnât make any logical sense to me, but I get it now. Iâll just use -999em instead (I couldnât break Opera with that no matter what i did).
I didnât realize you guys already trimmed the CCâs out until Ray pointed me to the article. Oh well, I still seemed to of managed to trim it some.
html:before, #wrapper:after {
content:ââ;
float:left;
height:100%;
clear:both;
margin-top:-999em;
}
Edit - nope- I got to test it more. It resolves the IE8/Opera issue but does not clear floats with the :after, so âas isâ there is no real benifit to combining them and using :after (if combining them, mine as well use my original :before). Iâll test play more.
Can somebody explain why the display block is needed in the #outer:after declaration?
âclearâ doesnât apply to inline boxes.
Duh!!!
Hello, itâs used to clear any floats, and as an added benifit, it (in part) enables ie8 to redraw the footer. You can use :before also to get ie8 inline, but then you loose the clearing effect. Iâm still trying to combine them, however I think itâs a no-go. Now for a sticky footer, weâre up to three extra blocks of code (one for IE6, one for IE8, one for Opera), that doesnât sit well with me.
Yeah, i see your point. Whatâs troublesome to me is that Opera and IE8 needs extra code. IE6 is no surprise
Dynamic content hs always been Operas archilles heel, IE8 and Opera are just rendering flaws that we canât helpâŚIE6 is justâŚIE6
Iâm a firm believer that Opera will correct that flaw soon
They have been having redraw problems since it first came outâŚlol :). If they do fix it soon due to the bug report then thatâs excellent
Alright, Iâm close again, I just need a way to get rid of the 1% height. Redraws perfect in both and clears any floats. Anything that negates the effect of 1% height makes Opera stop redrawing.
#wrapper:after, body:after {
content:ââ;
display:block;
clear:both;
height:1%;
}
Hi Eric,
If you are using that instead of your previous rules then it still wonât work in Opera unfortunately (unless you have made other changes not shown). Grab the bottom of the window and move it up and then down to see that itâs not working as expected. This has always been operas main problem.
I explained the issues in the quiz we set which eventually led to the [URL=âhttp://www.pmob.co.uk/temp/sticky-footer-ie8new-no-table.htmâ]final version.
There are only two real fixes in my code.
/*Opera Fix*/
body:before {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;/* negate effect of float*/
}
/* ie8 fix*/
#outer:after {
clear:both;
display:block;
height:1%;
content:" ";
}
In fact I could probably amalgamate those styles into one rules as follows:
/*Opera and IE8 Fix*/
body:before, #outer:after {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;/* negate effect of float*/
}
[URL=âhttp://www.pmob.co.uk/temp/sticky-footer-ie8new-no-table2.htmâ]
Example - not stress tested yet.
Hello, Ahh⌠I didnât notice that it wasnât coming back up - only looking for it to follow it down. Oh well. Yeah I already amalgamated it here. But then you loose the clearing floats effect, so not better off than just usingâŚ
html:before, #wrapper:before {
content:ââ;
float:left;
height:100%;
margin-top:-999em;
}
But then you loose the clearing floats effect
Thatâs true for your example but not for the code I just posted.
body:before, #outer:after {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;/* negate effect of float*/
}
That takes care of all issues.
How? It has no clear both. And even with clear both, I tested the same earlier, and the footer would rise right over the top of any (Edit - floated) text. Iâll assume Iâm missing something I guess.
Spoke too soon
I remember why that doesnât work now because I tried it before and you lose the background colour when the screen is short.
It would still need 2 rules:
/*Opera and IE8 Fix*/
body:before, #outer:after {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;/* negate effect of float*/
display:block;
}
#outer:after{
clear:both;
float:none;
margin:0;
}
Actually it might work with this but it needs checking again.
/*Opera and IE8 Fix*/
body:before, #outer:after {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;/* negate effect of float*/
clear:both;
}
No that fails also
I remember going through all these permutations before which is how I arrived at the two rules I was using