Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

does a server have to announce that style sheets are "text/css"?



Seth Gordon wrote:
> I've been making our family home page (http://ropine.com/)
> standards-compliant, and encountered an odd "feature" of Mozilla and
> Galeon.  If an HTML page has a DOCTYPE declaration (i.e., the browser
> renders it in "strict" rather than "quirks" mode) and a link to a
> stylesheet, but the server does not declare that stylesheet to be
> "Content-type: text/css", then the browser will ignore the stylesheet.
> 
> Is this actually following the standard?  The CSS1 spec says nothing
> about this, and in the CSS2 spec, "The text/css content type" (3.4) is
> not part of the "Conformance" section (3.2).  And it seems odd for the
> browser to be so picky about the Content-type header; unlike a situation
> where the browser is sent to a random URI and has to decide whether it's
> HTML or plain text or what, when a browser is told to fetch a CSS
> document, it *knows* it's fetching a CSS document.

I don't know if it's part of the "standard", but mozilla and IE (IIRC) 
require the correct mime type for stylesheets when running in strict 
mode. I ran into this myself recently when I was updating some internal 
apps to be 4.01 compliant.

If you're using mozilla, open the javascript console and load 2 pages: 
the first with a linked stylesheet not of type "text/css" and the second 
with the correct mime type. You'll notice the warnings when in quirks 
mode. It's just the way it is. And IMHO it's a good thing since we're 
supposed to be running in compliance with the standards.

It's easy to fix as well: just make sure the default handler is run for 
your .css files. Assuming apache:

<Location /css>
   SetHandler default-handler
</Location>






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org