Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-05-2003, 09:49 AM   PM User | #1
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Stylesheet not applying in Mozilla

One of the most frequently asked questions on this forum, is why stylesheets sometimes won't apply in Mozilla/Netscape6-7 (in standard or almost standard rendering modes), but applies on everything else, including Mozilla in quirks mode. The answer is simple: it's likely that your server isn't serving the file with a correct Content-Type header. To know whether the file sends the correct Content-Type header, go to <http://webtools.mozilla.org/web-sniffer/> and enter the address of your stylesheet file there, then look at the Content-Type header. If it is not 'text/css', then your server is not serving the file up as css.

Well, that was the problem. How to correct it? If your server is Apache, you can enter "AddType text/css;charset=utf-8 .css" into your .htaccess file (or create one if it doesn't already exist). In other cases, you should contact your server admin and ask them to correct it.


If you want a php file to be sent as css, you can use
PHP Code:
<?php 
header
("Content-type: text/css;charset=utf-8"); 
?>
(thanks, brothercake)

[asp, or how to set it in iis or ONE, anyone?]
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

Last edited by liorean; 09-08-2003 at 09:43 PM..
liorean is offline   Reply With Quote
Old 09-05-2003, 12:19 PM   PM User | #2
Vladdy
Senior Coder

 
Join Date: Jun 2002
Location: Nashua, NH
Posts: 1,724
Thanks: 0
Thanked 0 Times in 0 Posts
Vladdy is an unknown quantity at this point
You can type the address of the stylesheet in to the Moz/NS/FB address line and after page loads check the content type going to Tools (looking at FB Menu) -> Page Info.
(If you get the Open With box - that is a good indication that your stylesheet si served wrong)
__________________
Vladdy | KL
"Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"
Vladdy is offline   Reply With Quote
Old 09-05-2003, 12:31 PM   PM User | #3
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Yes, unless it's served as 'text/plain' which is often the case with Apache servers. Then it will be displayed instead. However, if you have the Live HTTP Headers extension that is an excellent choice.
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
liorean is offline   Reply With Quote
Old 09-05-2003, 01:04 PM   PM User | #4
krycek
Regular Coder

 
Join Date: Nov 2002
Location: Bristol, UK
Posts: 932
Thanks: 0
Thanked 0 Times in 0 Posts
krycek is an unknown quantity at this point
dunno why you just didn't make the original thread sticky; it was better and had all this info in it.

::] krycek [::
__________________
ithium | SOAPI | SDP | PTPScript manual
"ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

Last edited by krycek; 09-05-2003 at 02:15 PM..
krycek is offline   Reply With Quote
Old 09-05-2003, 02:06 PM   PM User | #5
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Less irrelevant information though. *Stickified*
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 12-25-2003, 06:23 PM   PM User | #6
angiras
Regular Coder

 
Join Date: Dec 2002
Location: France
Posts: 522
Thanks: 0
Thanked 0 Times in 0 Posts
angiras is an unknown quantity at this point
Sorry, web-sniffer is not available at this time because our new server is Linux, and Web-Sniffer currently only compiles on Solaris. If you think you can help, please see bug 220373.
angiras is offline   Reply With Quote
Old 01-15-2004, 04:04 PM   PM User | #7
spufi
New Coder

 
Join Date: Jan 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
spufi is an unknown quantity at this point
Am I missing something, or don't you just need the correct meta tag for this?

<meta http-equiv="Content-Style-Type" content="text/css">

I haven't had any problems with my CSS not being applied.
spufi is offline   Reply With Quote
Old 01-15-2004, 04:10 PM   PM User | #8
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Quote:
Originally posted by spufi
Am I missing something, or don't you just need the correct meta tag for this?

<meta http-equiv="Content-Style-Type" content="text/css">

I haven't had any problems with my CSS not being applied.
That meta tag is pointless - for the first, there is no Content-Style-Type header. Second, it's on the wrong document. That tag has one purpose, really, and that purpose is telling nn4 whether to use JSSS or CSS. Since the type attribute on the style tag is required, and the external files identify their content type in their header, there exists no viable reason for using it at all.

The Content-Type header of the actual css file is the one you must ensure is 'text/css' - and since you have not had any problems with it, I guess you are on a properly configured server.
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
liorean is offline   Reply With Quote
Old 01-15-2004, 04:36 PM   PM User | #9
spufi
New Coder

 
Join Date: Jan 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
spufi is an unknown quantity at this point
Actually, I haven't had any issues when testing not on a server and when using Mozilla. I just use my CSS externally linked like this...

<link rel="stylesheet" title="Default" media="screen" href="styles.css" type="text/css">
spufi is offline   Reply With Quote
Old 01-15-2004, 08:11 PM   PM User | #10
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Anyway, you shouldn't reply to stickies if you haven't got something to contribute to them. If you have wonderings about them, use a separate new thread asking about it. That way we can keep the signal to noise ratio as high as possible for the stickies.
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
liorean is offline   Reply With Quote
Old 04-15-2004, 08:43 PM   PM User | #11
Choopernickel
Regular Coder

 
Join Date: Apr 2003
Location: Atlanta, GA
Posts: 487
Thanks: 0
Thanked 0 Times in 0 Posts
Choopernickel is an unknown quantity at this point
If you'd like to create external stylesheets in ColdFusion, use this prefix:
Code:
<cfcontent type="text/css;charset=UTF-8" reset="yes" />
It will do just what the php in the first post of this thread will do. If you're using Fusebox (or another framework which demands entry through a single point), you should add a reset="yes" attribute to the cfcontent tag, and append a <cfabort /> at the end of the stylesheet template.
Choopernickel is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:30 PM.


Advertisement
Log in to turn off these ads.