简体   繁体   中英

Background image not showing CSS

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:

在此处输入图片说明

If your stylesheet is inside the CSS folder, the CSS rule should be like this:

background: url("../images/about.jpeg") no-repeat center top;

ie, go out of the "css" folder and into the "images" folder

css file is unable to locate your image.

you have to change your image url to

url("../image_url")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM