Reputation: 356
I would like to have a background-image on my website. For some reason when I use a placeholder (background: url(http://via.placeholder.com/1920x500) no-repeat center top;)
, the placeholder appears with no issues, but when I use the image sitting on my laptop... It does not show. Below is how I display the image:
background: url("/images/about.jpeg") no-repeat center top;
I also tried:
background-image: url("/images/about.jpeg") no-repeat center top;
and I get the same result. Please assist the new guy to CSS
Below is the file structure:
Upvotes: 0
Views: 43
Reputation: 1204
css file is unable to locate your image.
you have to change your image url to
url("../image_url")
Upvotes: 0
Reputation: 67768
If your stylesheet is inside the CSS
folder, the CSS rule should be like this:
background: url("../images/about.jpeg") no-repeat center top;
i.e., go out of the "css" folder and into the "images" folder
Upvotes: 3