bgold12 wrote:
I was using quirks mode (without a doctype) and set the overflow CSS
property to :auto for the body tag like so:
<body style="overflow:auto">
And it worked; it got rid of IE's default scroll bars. However, when I
tried to add any doctype at all (HTML strict, HTML loose, XHTML
transitional, XHTML strict, etc.), it stopped working. Do I have any
control over IE's scroll bars when using doctypes?
This sounds like a CSS question rather than an HTML issue, but it's really
gray area.
In the broken mode of operation of old IE browsers, still emulated in newer
versions of the browser (including IE 7) in "quirks" mode, the <body>
element is treated as the root element for purposes of rendering. In the
correct mode, <htmlis the root element.
In the correct mode, the scrollbars you see relate to the <htmlelement.
You can see this by using an IE-specific nonstandard CSS property:
html { background: green; scrollbar-base-color: red }
(In "standards" mode, IE still recognizes such nonstandard properties.)
By default, IE uses a vertical scroll bar for the root element. This is not
describable in standard CSS, which does not distinguish between vertical and
horizontal overflow, but it is still overridable in standard CSS by setting
e.g. overflow: auto, as you have done. Yet, to make this work in "standards"
mode as well, you need to add
html { overflow: auto; }
into your style sheet, because in "standards" mode, <htmlis the root.
Beware that this is just one of many, many differences between quirks and
"standard" mode, and this one wasn't even described in my longish list at
http://www.cs.tut.fi/~jkorpela/quirks-mode.html
though I will add it there.
The bottom line is:
1) Use a standards-conforming doctype for new documents, triggering
"standards" mode.
2) Don't touch old documents by just putting a doctype there, unless you
know what you are doing and you are prepared to spending quite some time
with layout problems.
Yucca