Previous Message
Next Message

Re: [css-d] css file extensions?

Sent by Liorean on 31 January 2002 17:05


At 09:41 2002-01-31 -0800, my2cents wrote:
>I'm wondering about the file extension of the imported sheet. Is it 
>necessary they be named foobar.css? Will foobar.html work? Will foo.bar 
>work (a custom extension)? (In my environment/cms/etc, it'd be much easier 
>if i could name them .html instead of .css.)

No, it doesn't matter what file extension the css use.
BUT, you must make sure the CSS is served as text/css, and nothing else, 
from the server. It it's served as text/plain, application/octet-stream, 
text/html or such, it won't render in Mozilla and derivates, and any other 
browser that strictly follows W3C recommendations.

>I suppose there are two angles: Most Importantly: does the 
>browser/html/code have a problem with it?  2nd: does the webserver have a 
>problem with it? (A mime type issue, eh, which should just be a 
>configuration issue)

Mozilla ignores any stylesheets not served as text/css (except xsl, which 
it handles).
Servers may have problems returning two files with .html file extension as 
text/html and text/css respectively. Apache has some confs that might be of 
service for that, though.

>Does the answer very by browser? (I've got to support just about 
>everything, including 3.0's.) Anything else I should consider?

Yes, it varies. Opera to date, Internet Explorer (all platforms), Netscape 
Navigator all allow other content types. Mozilla and derivates, and a few 
other open source browsers don't, however.

// Liorean
Previous Message
Next Message

Possibly related: