<link rel="stylesheet" href="stylesheets\background-style.css">
This is how we link a stylesheet with a backward slash to denote the path I used VScode to find out the relative path
body{
background: -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.8)),
url("J:\Web\Animation\Replica\images\background.jpg") no-repeat bottom;
}
I once again used VScode to find out the path(not the relative path as in the previous case) But it didn't work.
body{
background: -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.8)),
url("J:/Web/Animation/Replica/images/background.jpg") no-repeat bottom;
}
So what I did was, I changed all the backward slashes into forward slashes and it worked
<img src="J:\Web\Animation\Replica\images\background.jpg" alt="">
I added the same backslash path to the image element and it worked.
My question is, Why does background-image require a different path?
Aucun commentaire:
Enregistrer un commentaire