Complete list of reasons why a css file might not be working

后端 未结 19 2125
醉酒成梦
醉酒成梦 2020-12-09 02:20

This problem is making me feel like an absolute noob.

Here is the head of my .html file:




        
相关标签:
19条回答
  • 2020-12-09 02:22

    I had the same problem, chinese characters were appearing in firefox when uploaded to web server, but not on localhost. I copied the contents of the css file to a new text file. All working now. Must have been a unicode/encoding error of some sort.

    0 讨论(0)
  • 2020-12-09 02:22

    My simple think you missed type="text/css".

    0 讨论(0)
  • 2020-12-09 02:23

    Try:

    <link type="text/css" rel="stylesheet" href="http://fakedomain.com/smilemachine/html.css" />
    

    If that doesn't work either, then make sure the URL is accessible, and the content is what you are looking for.

    0 讨论(0)
  • 2020-12-09 02:23

    I don't think the problem lies in the sample you posted - we'd need to see the CSS, or verify its location etc!

    But why not try stripping it down to one CSS rule - put it in the HEAD section, then if it works, move that rule to the external file. Then re-introduce the other rules to make sure there's nothing missing or taking precedence over your CSS.

    0 讨论(0)
  • I stylesheet may not get loaded for several reasons. But the main approach to solve such a problem is as follows:

    1. After loading the page, press F12 to open the Developers Console. Check the console for any logged errors.

    2. Then you should check the Stylesheet tab and see the list of stylesheets the browser loaded.

    3. The URL you're using inside your HTML link tag may be unaccessable, so manually try to visit the stylesheet with a browser and see if everything renders correctly.

    4. Any typo inside your HTML or CSS stylesheet may cause the stylesheet from loading.

    5. Check for any occurrences of fatal errors before your <link> tag. A fatal error may stop the running code and suspend the page, thus not including your stylesheet.

    Hope that helps.

    0 讨论(0)
  • 2020-12-09 02:26

    The URL http://fakedomain.com/smilemachine/html.css in your <link> Tag is wrong. File not Found.

    0 讨论(0)
提交回复
热议问题