This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Firefox won't load CSS for local website

  • 13 replies
  • 37 have this problem
  • 1 view
  • Last reply by Dcage

more options

Hi,

I know you have all seen this question before but none of the answers I have found work for me. My site loads perfectly fine in other browser, just not Firefox.

I have a local website with a style sheet that is saved in the same folder:

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

I have defined the character sets in the HTML and CSS documents:

HTML = CSS = @charset "UTF-8";

I have both the latest updates for Chrome, IE and Firefox as of today.


Any help would be much appreciated.

Thanks

Hi, I know you have all seen this question before but none of the answers I have found work for me. My site loads perfectly fine in other browser, just not Firefox. I have a local website with a style sheet that is saved in the same folder: <link rel="stylesheet" href="style.css" type="text/css" /> I have defined the character sets in the HTML and CSS documents: HTML = <?xml version="1.0" encoding="utf-8"?> CSS = @charset "UTF-8"; I have both the latest updates for Chrome, IE and Firefox as of today. Any help would be much appreciated. Thanks

Chosen solution

Did you check the Web Console (Firefox/Tools > Web Developer) for error messages?

Does the local server send the correct content type for all files?

Can you load the CSS file directly via the location/address bar?

You can check in "Tools > Page Info > General" how Firefox see this file.

Read this answer in context 👍 0

All Replies (13)

more options

Please post a public link so we can check it out.

more options

https://jsfiddle.net/za9u459k/1/

Here is the fiddle. Obviously the pictures won't load but you can see some of the basic CSS. Note that I have put the <head> in a comment for the sake of jsfiddle.

Many thanks

more options

Looks okay to me. I've called the big guys to help you. Good luck.

more options

Chosen Solution

Did you check the Web Console (Firefox/Tools > Web Developer) for error messages?

Does the local server send the correct content type for all files?

Can you load the CSS file directly via the location/address bar?

You can check in "Tools > Page Info > General" how Firefox see this file.

more options

I didn't mean to resolve this problem.

I can load the style sheet but it won't load automatically, is also doesn't load the pictures.

The stylesheet and html are both saved to my documents.

I downloaded web developer addon and there are a few errors but nothing that appears to be affecting the css.

How do I get to tools>page info?

more options

Dcage said

How do I get to tools>page info?

Right click on the webpage and select "View Page Info".


The pictures will not load in jsfiddle because of crossdomain reference and incorrect local sources. However locally if they are not showing in that View Page Info you can check to make sure that images are not blocked. Another common mistake is the permissions on the images if you are working on a linux machine.

I think for Firefox specifically you have to use an absolute path the css local file: http://kb.mozillazine.org/Links_to_local_pages_don't_work for more information about network preferences also see https://developer.mozilla.org/en-US/d.../Mozilla_networking_preferences

more options

I'm not sure if you can use base this way to link to external files: <base href="C:\Users\Josh Stewart\Documents\Websites\New_AM_Website\"></base>

Best would be to store the files in the same directory as the HTML file.

more options

cor-el said

I'm not sure if you can use base this way to link to external files: <base href="C:\Users\Josh Stewart\Documents\Websites\New_AM_Website\"></base> Best would be to store the files in the same directory as the HTML file.

All files are in the same directory as the html and css, that base tag is just to tell the browser where that folder is.

more options

guigs said

Dcage said
How do I get to tools>page info?

Right click on the webpage and select "View Page Info".


The pictures will not load in jsfiddle because of crossdomain reference and incorrect local sources. However locally if they are not showing in that View Page Info you can check to make sure that images are not blocked. Another common mistake is the permissions on the images if you are working on a linux machine.

I think for Firefox specifically you have to use an absolute path the css local file: http://kb.mozillazine.org/Links_to_local_pages_don't_work for more information about network preferences also see https://developer.mozilla.org/en-US/d.../Mozilla_networking_preferences

Firefox sees the file correctly.

text/html

UTF-8

Has the correct file directory.

This is crazy, I have never seen this happen in firefox before.

more options

I also tried the full url for the css but had no luck

more options

This still isn't working. How crazy is this.

more options

Any error messages in the Web Console (Firefox/Tools > Web Developer)?

How does the CSS file start?

There should only be CSS code in the file and you should save the file as Unicode (UTF-8) if the HTML file has this encoding as well.

more options

I've attached a screenshot of the Error Console. There is only CSS code in the css file and it is saved as UTF-8.

When I'm in web-developer, where would the errors appear? There is nothing immediately obvious.

Many thanks again

This is confusing me