<html>
<head><style>
<!--[if !IE 7]>
#page {display:table;height:100%;}
<![endif]-->
</style></head>
<body>
[INDENT]<div id="page">[/INDENT]
[INDENT][INDENT]<div id="main>[/INDENT][/INDENT]
[INDENT][INDENT]</div> <!--END OF MAIN-->[/INDENT][/INDENT]
[INDENT]</div> <!--END OF PAGE-->[/INDENT]
[INDENT]<div id="footer">[/INDENT]
[INDENT]</div><!--END OF FOOTER-->[/INDENT]
</body>
</html>
Here’s the relevant CSS:
html {height:100%;}
body {height:100%;}
#page {min-height:100%;}
#main {
overflow:auto;
padding-bottom:150px;
}
#footer {
clear:both;
position:relative;
width:100%;
margin-top:-150px;
height:150px;
}
This works to keep a 150px high footer stickied to the bottom, except it doesn’t work in IE 7. However, if I add “padding-bottom:150px;” to the #page div CSS then it works…
…but why? I’m sure it’s elementary, but I’m not seeing it.
As I’m writing this I’m wondering if the WYSIWYG visual editor within WP could be the culprit.
I suspect that is your problem. I have seen the WP editor inject <br> tags after images which caused problems when floating them. What would happen is everytime you would add whitespace in the editor it would put the <br> tag in there which you could not see unless you viewed the page source. That is just one example too, it does other strange things similar to that.
After all, it’s a WYSIWYG editor so it doesn’t surprise me.
I don’t do WP but if I remember correctly you can adjust the settings on it. You can find more info on that from someone who works with WP or at their own forum.
They specifically wanted a WP CMS site so I took wp_edublog by Tracy Ridge and modified it to their specs: no sidebar, blog, or rss (header graphic is just temporary). You may notice the sidebar id div still in the code, but with no CSS - I don’t have enough experience to start removing WP PHP functions without fear of messing something up.
As I’m writing this I’m wondering if the WYSIWYG visual editor within WP could be the culprit. I had my friend fill in the content as they saw fit, but not in straight code. I feel I’m just grasping at straws, though.
It looks like the main problem you are having with IE7 (and all IE’s) is your doctype. The lack of a proper doctype will put all versions of IE in quirks mode.
We really don’t suggest using display:table; as an IE8 fix anymore. Opera also has a min-height;100% bug and they can both be fixed by using some pseudo :before and :after blocks. It is explained in the FAQ link below.
…then I switched to STRICT from TRANSITIONAL and it worked perfectly.
Hi,
Unless this is an old site that is actually in transition you should not be using a transitional doctype anyways.
For the sake of testing though I set up this bare bones example with a trans doctype. It uses the same method as I showed earlier and I don’t see any problems with it in Opera.
Any hints?
We would need to see the code that you are working with to pinpoint the trans problem. I suspect there is something else causing problems there.