472,125 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,125 software developers and data experts.

CSS & Firefox problem

I'm having nightmares with CSS at the moment. Can anyone help me out?

I'm including my stylesheet using the following code

<head>
<title>My Title.</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css"></link>
</head>

In IE this works fine

However, in FireFox it is as if the stylesheet was never loaded at all
(Although checking the server logs shows that firefox successfully
retreived the page)

I'm running IIS6, I've turned off HTTP compression and Ensured that it
is sending the correct MIME type (text/css)

If I copy the contents of stylesheet.css and paste it between
<style></style> tags, then it works fine, and it also works if I save
the .html and .css files to disk and view it locally in FireFox

I'm out of ideas. I could just put the whole stylesheet in
<style></style> tags, but it would be a horrible waste of bandwidth.

Can anyone help?

Jul 21 '05 #1
12 18616
an*********@yahoo.co.uk wrote:
I'm having nightmares
You're taking your job too seriously. <g>
with CSS at the moment. Can anyone help me out?

I'm including my stylesheet using the following code

<head>
<title>My Title.</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css"></link>
</head>


Try removing that redundant </link> at the end.

http://validator.w3.org/

--
-bts
-This space intentionally left blank.
Jul 21 '05 #2
I've tried without the redundant </link> but still have the same
problems.

Jul 21 '05 #3
Just to add some extra details

I've had this problem on another site on the same server. I'm leaning
towards it being a problem with the server. Has anyone got any ideas on
what I can change on the IIS6 server?

Jul 21 '05 #4
an*********@yahoo.co.uk wrote:
I'm including my stylesheet using the following code

<head>
<title>My Title.</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css"></link>
</head>
The </link> is just plain wrong in HTML and is against the
compatability guidelines and best practice in XHTML. Get rid of it.
However, in FireFox it is as if the stylesheet was never loaded at all
(Although checking the server logs shows that firefox successfully
retreived the page)
And you haven't done anything silly like install the Web Developer
toolbar, turn CSS off and forgotten to turn it back on?
I'm running IIS6, I've turned off HTTP compression and Ensured that it
is sending the correct MIME type (text/css)


Well the content-type header would be the first thing to check.
Without a URL we'll have to take your word for it that it's correct.

Is there any HTML inside the CSS file? Any <style> tags? Any HTML
comments <!-- -->? Get rid of any of those.

Beyond that we need a URL so we can see the entire HTML, the entire
CSS and all the HTTP headers.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 21 '05 #5
try

<link rel="stylesheet" type="text/css" media="all" href="stylesheet.css" />

and what doctype are you using?

<an*********@yahoo.co.uk> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
I've tried without the redundant </link> but still have the same
problems.

Jul 21 '05 #6
I've scrapped the </link> (I only put it in there out of desperation
when I couldn't get it working)

I used the header checker at http://www.delorie.com/web/headers.html

And it produces this on a direct access to the .css file:

HTTP/1.1 200 OK
Content-Length: 1270
Content-Type: text/css
Last-Modified: Fri, 18 Feb 2005 12:41:33 GMT
Accept-Ranges: bytes
ETag: "25116e2db715c51:e37"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Fri, 18 Feb 2005 14:48:33 GMT
Connection: close

The CSS works fine (even in Mozilla) with existing pages.

I've checked the HTML, it's 'almost' valid HTML4.01. (It throws up a
couple of errors where a background attribute is used in a table but
apart from that it is valid, I'll use CSS for backgrounds once I get
CSS working)

Jul 21 '05 #7
>and what doctype are you using?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

I've also tried it without a doctype at all, with no change in results

Jul 21 '05 #8
an*********@yahoo.co.uk wrote:

Please quote some of the post you're replying to. Messages propagate
at different rates and people may see your reply before mine. It also
helps to know which parts of my post you're replying to and which
you're ignoring.
The CSS works fine (even in Mozilla) with existing pages.


Do those pages use the same doctype as the problematic ones? If the
new ones trigger Standards mode and the old ones trigger Quirks mode
then Mozilla can reject CSS that was previously accepted.

Post the URL or give up.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 21 '05 #9
> Please quote some of the post you're replying to. Messages propagate
at different rates and people may see your reply before mine.
Sorry, I'm using Google Groups rather than my usual newsreader as I'm
at a client site and wasn't used to the new interface they have.

I have it sussed now though :-)
The CSS works fine (even in Mozilla) with existing pages.


Do those pages use the same doctype as the problematic ones?


The old pages don't have a doctype at all.
Post the URL or give up.


OK, it's an adult site so probably not worksafe...

http://ukescorts.brightlamp.com/topfemales1.html

To see the original page, go to:

http://www.ukescorts.com/search_form.asp

Don't change anything on the dropdown and click on search to get the
page.

Jul 21 '05 #10
an*********@yahoo.co.uk wrote:
>The CSS works fine (even in Mozilla) with existing pages.
Do those pages use the same doctype as the problematic ones?


The old pages don't have a doctype at all.


So they definitely trigger quirks mode. The new one triggers Standards
mode.
Post the URL or give up.


OK, it's an adult site so probably not worksafe...


Work from home, so more worried about it being girlfriend-safe...
http://ukescorts.brightlamp.com/topfemales1.html


Hmm, Firefox is definitely fetching the CSS but not using it. There
are some errors in your CSS:
http://jigsaw.w3.org/css-validator/v...1&profile=css2
but nothing that should cause the whole stylesheet to be ignored.

I get the same problem even when I download the files and view the
local copy so it doesn't seem to be a server problem. Taking the
doctype out and thus forcing quirks mode doesn't help either.

Ah, it's in UTF-16. I'd try changing to a different encoding, UTF-16
can cause some unusual things to happen. For a UK-centric page written
entirely in English there's no good reason to use UTF-16.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 21 '05 #11

Steve Pugh wrote:
Ah, it's in UTF-16. I'd try changing to a different encoding, UTF-16
can cause some unusual things to happen. For a UK-centric page written entirely in English there's no good reason to use UTF-16.


Bingo!

I added the following line:

<META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">

And as if by magic, the styles appeared :-)

Thank-you very much indeed for your help. I'd never in a million years
thought about changing the encoding.

Does anyone know how I can change the default character set for .html
files served by IIS6 without resorting to http-equiv tags?

Jul 21 '05 #12
> I added the following line:

<META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">

And as if by magic, the styles appeared :-)


Actually, no, that's not what fixed it.

I finally got to the root of the problem. The application I wrote to
generate the .html files was saving the files in Unicode format, hence
breaking it.

When I tried locally, what I actually did was view the source on the
web page and saving it locally using my text editor (saving it in ASCII
and therefore fixing it)

When I added the meta-equiv tag, I edited the generated .html file with
a text editor rather than re-running the .html generating app, so it
got saved in ASCII again.

I'm suprised it didn't dawn on me that the two sites I was having css
problems with were the two sites using this .html generating script.

I'm quite relieved to have this sorted now :-)

Thanks again for your help.

Jul 21 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by rbronson1976 | last post: by
4 posts views Thread by L2XL | last post: by
14 posts views Thread by Arne | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
24 posts views Thread by Swifty | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.