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

后端 未结 19 2127
醉酒成梦
醉酒成梦 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:38

    Firefox can reject a stylesheet if it is not served with a content type of "text/css". (This is separate from the 'type="text/css"' declaration in the HTML.)

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

    In my case, the problem was with the media option:

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

    I solved by removing it:

    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    
    0 讨论(0)
  • 2020-12-09 02:40

    I have another one. I named my css file: default.css. It wouldn't load. When I tried to view it in the browser it showed an empty page.

    I changed the name to default_css.css and it started working.

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

    Could it be that you have an error in your CSS file? A parenthesis left unclosed, a missing semicolon etc?

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

    I'm using Wordpress and the stylesheet was set to enqueue to the footer

    wp_enqueue_style(
            'editor-css',
            $stylesheet_directory_uri . '/assets/css/editor.css',
            ['wp-edit-blocks'],
            null,
            true   // $in_footer
        );
    }
    

    This resulted in a media="1" attribute getting added to the <link> tag and resulted in the stylesheet being loaded but not applied.

    Changed the parameter to false and its working now

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

    I had a problem like this! I was able to fix it following

    Step 1>>from Abraar Arique post, I went into the console>> Went under Style Editor and found Firefox wasn't loading the updated copy of my css file.

    I cleared all history and reload the page then my problem was fixed.

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