Reputation: 23
I am trying to add a background using the following, placed inside custom.css:
}
body {
background-image: url("img/background.jpg");
}
custom.css is in folder HTML/css
background.jpg is in folder HTML/img
What should I do so that the background works? Right now it doesn't appear at all.
Upvotes: 0
Views: 51
Reputation: 425
Please use :
body{
background-image: url('../img/background.jpg');
}
Upvotes: 0
Reputation: 9157
Go up a level with your URL selector using ..
:
background-image: url("../img/background.jpg");
That will go up a level (to the HTML
folder) and then find the background.jpg
file in the img
folder.
Upvotes: 2
Reputation: 2528
It's because your 'img' folder is in a different directory to your 'css' folder.
Try
background-image: url("../img/background.jpg");
Upvotes: 0