Forum Moderators: not2easy
My CSS works fine with Windows Internet Explorer, and passes w3c validation, but Firefox simply does not register the .css file and loads my page as if the CSS does not exist. Incidentally, when the code is imbedded in the xhtml through <style> tags in the header, it works fine - and I have triple checked that the <link> tags link to the correct CSS file.
So I've saved the following in the .css file:
body{font: 70% sans-serif}
div#image{float:right}
div#introduction{margin-top:28px}
div#maininformation{clear:both;margin-left:150px;margin-right:150px}
Anybody have any idea? I've been wrestling with this for some time.
Thanks,
delmonte
Check it be trying to view the full URL where the CSS is served from
e.g. http://www.example.com/some/directory/stye.css
And next check the tools/page info (command-I on a mac, unsure what if any keyboard shortcut exists for it on windows). The second line of the general tab should read "type: text/css"
if this isn't the case, check your server settings (e.g. mime.types in apache).
Still if your mime.types are in order, try thee two files:
index.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>untitled</title>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>
<body>
<p>Not working or </p>
</body>
</html>
test.css
p:after {
content: ' working';
color: green;
}
p {
color:red;
}
put them in the same directory and check the result.
If that still doesn't work I'd suspect something server or client side amiss (try another client first, that's likely to be the easiest (safari, opera, ...) )
Validating is important, but in the end it's not because it validates that you are telling the browser something that matches what you intended to say.
Moreover IE does parse and act on stuff that for all other purposes are comments (conditional comments)
[rant on]
IE is very "Error Forgiving"IMHO this should be "IE is very Error Inducing" e.g. its overzealous use of quirksmode, its broken box model, all the named bugs that never got fixed.