By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,812 Members | 875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,812 IT Pros & Developers. It's quick & easy.

CSS & Firefox problem

P: n/a
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
Share this Question
Share on Google+
12 Replies


P: n/a
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

P: n/a
I've tried without the redundant </link> but still have the same
problems.

Jul 21 '05 #3

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
>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

P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a

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

P: n/a
> 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.