I’m having an issue with IE6 compatibility on a Boilerplate (and HTML5Shiv) project. I’ve been attempting to set the <html> element to be the same height as the <body> element but for whatever reason, it is fixed on 100% without any specific code. Each page’s length is dynamic so I cannot set specific values.
I want to do this because of one primary reason — IE6 is not displaying the scrollbar even though there is additional content below.
I’ve tried to set the height via the following code without any luck:
$("html").css("height", parseInt($("body").height()) + "px");
I’ve also attempted the following code and only the <body> element responds:
$("html, body").css("height", "2000px");
However, I have been able to add scrolling through a band-aid fix:
html, body {
overflow-y: scroll;
}
Now back to the height problem, is this even possible via jQuery? Does IE6 simply not support what I’m after?
Thanks!
I’m surprised nobody has mentioned this yet.
Forget trying to size the
<html>element.The
htmlelement isn’t meant to be sized. I wouldn’t bother trying to maker a smallerbodyeither. If you need an element of a certain size, stick adivinside yourbodyand style that.The HTML4 specification for the
htmltag doesn’t liststyleas an attribute, and it’s easy to understand why.Even in a modern browser like Chrome, trying to size the
htmlelement gives slightly odd results: http://jsfiddle.net/QdCmM/.