"The stylesheet was not loaded because its MIME type, "text/html" is not "text/css"

154,384

Solution 1

Actually I had wrongly put href="", and hence the html file was referencing itself as the CSS. Mozilla had the similar bug once, and I got the answer from there.

Solution 2

In the head section of your html document:

<link rel="stylesheet" type="text/css" href="/path/to/ABCD.css">

Your css file should be css only and not contain any markup.

Solution 3

This is more likely an issue at your server side. you request style sheet page "Styles/Site.css" from the server of type "text/css", but your server might be responding to this request with "test/html". I had this issue when my server was running in python and it was replying to requested css files with header text/html (as that of my index.html file). I re-arranged my server code and assigned the correct headers to its corresponding pages and my issue got resolved.

Solution 4

You are trying to use it as a CSS file, probably by using

<link rel=stylesheet href=ABCD.html>

or

<style>
@import url("ABCD.html");
</style>

Solution 5

In Ubuntu In the conf file: /etc/apache2/sites-enabled/your-file.conf

change

AddHandler application/x-httpd-php .js .xml .htc .css

to:

AddHandler application/x-httpd-php .js .xml .htc
Share:
154,384
Suraj Chandran
Author by

Suraj Chandran

....and all the difference lies between O(n.logn) and O(n^2) Site: www.scratoo.com

Updated on March 22, 2020

Comments

  • Suraj Chandran
    Suraj Chandran over 4 years

    I have a javascript application and when I run it on firefox I am getting the following erro on the console:

    "The stylesheet was not loaded because its MIME type, "text/html" is not "text/css".

    DumbStuck!!

    EDIT: Note that it tells that "The stylesheet ABCD..." But ABCD is actually an HTML file.

    Edit (ANSWER) : Actually I had wrongly put href="", and hence the html file was refenecing itself as the CSS. Mozilla had the similar bug once, and it is from there I got the answer. But everyone's else answers helped me too. Thanks.

  • Felix Kling
    Felix Kling over 14 years
    The OP said, ABCD is an HTML file. So it is wrongly recognized as CSS (I guess).
  • Sebastian Paduano
    Sebastian Paduano over 4 years
    Did not worked for me