20
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CSSファイルが読み込めない原因。パスにあります。(Refused to apply style from 'https~' because its MIME type~)

Posted at

#CSSが読み込めない
ディベロッパーツールで確認すると、

Refused to apply style from 'http://localhost:9000/css/reset.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

のエラー。

読んでみると、『MIMEタイプがサポートされていない』と書かれていますが、問題はそこではなくて。

cssのパスの違いにありました。

#パスを変える

├── dist
│   ├── index.html *
│   ├── main.js
│   ├── style.css
└── css
index.html(修正前)
<link rel="stylesheet" href="./css/style.css">
index.html(修正後)
<link rel="stylesheet" href="style.css">

原因は相対パスの起点にありました。

起点は、

現在ブラウザで実行されているファイルで、そこからの相対パスを書かなければいけません。

20
12
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?