Scrollbar colors

If anyone would care to tell me why my CSS stylesheet is not coloring my window scrollbars right (under IE 6-- seems to work OK with prior versions and works on scrollbars within the page like for textareas and so forth), I would really appreciate it.


I had the same problem; it was remedied by removing any "doctype" or "content type" references in the header. Try that. It should work.

Brad said:

You are correct sir! I guess Microsoft considers that feature something that belongs in the 'quirks' mode that is turned off with proper DOCTYPE and XHTML like I'm trying to do. Strange that all the inner scroll bars use the colors-- you'd think that if those descriptors are disabled, they'd be disabled for everything. Anyway, many thanks Chris. Keep up the good work my friend.

Try changing the "body" for the scrollbar rules to "html, body" or "*". Then you should be able to include the strict doctype and still see the styled scrollbars.

Internet Explorer (non-quirks-mode only) and Mozilla consider "body" to mean "a block containing all of the page's content" and consider "html" to mean "the viewport". Try applying "body { border: 1px solid red; }" to a short page, with and without a doctype, to see what I mean. Since the scrollbar is a viewport thing, it makes sense for styles on the html element to apply but not on the body element. (Note: the bgcolor property is an exception to this rule, so bgcolor always to the viewport for both html and body.)

I do not know the history behind the decision to make body be just the content.

Thanks, by the way. Now I know why my user style sheet of IE wasn't working correctly on some sites. I had "body, frameset { border-right: 0px ! important }" in my user style sheet to keep the scrollbar at the right edge of the screen instead of 2 pixels from the right edge of the screen. The trick didn't work at some sites, including my site, but it didn't occur to me that it was my doctype that was preventing it from working.

Dracusis said:

No, it's not the DocType. You really shouldn't be removing the Doctype, that's the most important bit of the document!

Just shift the {border-right: 0px ! important} rule into a html {} selector and all should be fine.


This article was published on February 26, 2002 12:44 PM.

The article previously posted was XHTML 1.0 Compliant.

The next article is Email sucks.

Many more can be found on the home page or by looking through the archives.

Powered by Movable Type