views:

61

answers:

2

Hi,

I have a strange problem, Firefox 3.6.3 doesn't show the CSS of the page I'm doing, but Internet Explorer 8 does.

I have tried at home and at one of my friend's home, and it happens in both. But, if I go to the Firefox Web Developer toolbar (i have it installed) and select CSS=>Edit CSS, then the styles appears appears in the page and in the editor! As soon I close it, they disappears again. I have no idea what the problem is :(

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Students</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

I've validated my two css files with the W3C CSS validator and there are no problems.

Do you have any idea about what could be the problem?

thanks in advance.

+3  A: 

I'll bet a beer that the CSS file is not sending the content-type: text/css header. This causes style sheets to not work in Firefox. IE will ignore the content type.

If this is the reason, you should get a warning in the Firefox error console. You can use Firebug's net tab to verify the content-type sent.

As to why the content type isn't sent, this would be a server issue I think. It usually happens when the CSS file is a .php or .asp file that doesn't get assigned the correct content type automatically by the server when delivering.

Pekka
You won the beer !!! I've set up a handler that handles all requests, so when the browser is asking for .css or images, I have to serve them myself, then I forgot to put the correct ContentType... geez...Thanks a lot you save my day ;D
vtortola
Wow, and even a proper *irish* beer! I would really like that but alas, alas, beer is so hard to post ;)
Pekka
haha I'll drink a Guinness on your sake ;D
vtortola
+1  A: 

Navigate to your css file directly in Firefox (http://www.yoursite.com/style.css) and look at your Page Info (Tools >> Page Info).

If the css file is being submitted as text/html, it's an incorrect MIME type (should be text/css) and you will need to contact your server/host administrator to fix this for you if you don't have access to that.

JN Web