Technical Details

It seems that the horizontal scroll bar appears because Internet Explorer does not allow for the vertical scroll bar when making its calculations of the width.

The precise conditions for the bug to show up are:

If scrolling="yes", the horizontal scroll bar disappears. As you would expect, it also disappears if scrolling="no"!

Internet Explorer 6 renders pages in one of two different ways. When "standards-compliant mode" is switched on, it is supposed to comply with the latest standards of the World Wide Web Consortium. When "standards-compliant mode" is switched off, it goes its own way, following the behaviour of previous versions. Microsoft's name for the non-standards-compliant mode is "compatibility mode", but most web designers call it "quirks mode".

The choice of the mode depends on the <!DOCTYPE> declaration. If there is no <!DOCTYPE> declaration, standards-compliant mode is turned off. For most <!DOCTYPE> declarations, standards-compliant mode is turned on. The following table, taken from Microsoft's website, shows the exact details of whether standards-compliant mode is on or off.

LabelDefinitionURL presentURL not present
No !DOCTYPE present OffOff
HTML (No Version Present) Off Off
HTML 2.0 OffOff
HTML 3.0 OffOff
HTML 3.2 OffOff
HTML 4.0No Definition PresentOnOn
HTML 4.0 FramesetOnOff
HTML 4.0TransitionalOnOff
HTML 4.0StrictOnOn
XHTML OnOn
XML OnOn
Unrecognized !DOCTYPE OnOn

The curious ones are the HTML 4.0 Frameset and Transitional definitions. They run in standards-compliant mode when the URL of the DTD is specified, but in quirks mode if it is not. The best explanation that I could come up with as to why Microsoft chose to do this is that they wanted to provide an option whereby you could validate a page but still use quirks mode. I'm not sure that anyone would want to!

For a full explanation of the modes, see Microsoft's own article, "CSS Enhancements in Internet Explorer 6".

Furthermore, there is another bug in Internet Explorer. If there is anything before the <!DOCTYPE> declaration, it will switch to quirks mode. This includes a comment line or the XML declaration in an XHTML1.1 document, eg <?xml version="1.0" encoding="ISO-8859-1"?>.

Other Solutions

  1. Add a comment or an XML declaration before the <!DOCTYPE> declaration. This will work, but it will have the undesirable effect of switching off standards-compliant mode in Internet Explorer, so all the effort you went to to ensure that your document would be presented correctly may be wasted.
  2. Remove the <!DOCTYPE> statement from the beginning of the page. Of course this is definitely not recommended practice, and it will prevent your page from validating.