LoginSignup
2
0

More than 1 year has passed since last update.

Sassで画像が見つからず404 (Not Found)がでる

Last updated at Posted at 2021-09-14

404 (Not Found)がでる

Failed to load resource: the server responded with a status of 404 (Not Found)

sassで記述するときパスがわかりづらい

統合先のstyle.cssからの相対パスを入力

記述中のVSCodeの補完機能のパスは、各scssからの相対パスになっているので、惑わされず統合先のstyle.cssの階層からの相対パスを入力する

もしくはHTMLのタグに記述する

背景系はこちらの方がわかりやすかったりする

背景色

<body style="background: url(images/yellow.jpg);">

divタグにも

<div class="animal" style="background-image: url(images/dog.jpg)"></div>

デメリット

*記述箇所が多いとHTMLコードの見た目が煩雑になる

それでも適用されない場合

HTMLで記述したタグ名内に余分スペースがないか確認する
(気づかないときは本当に気づかない)
1時間ハマった

#タグ名のあとに半角スペースが2つある
<body  style=
<div  class="animal"
2
0
0

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
2
0