image url in CSS

前端 未结 3 2023
别跟我提以往
别跟我提以往 2021-01-07 03:25

I was just trying to change my site around a little, but I bumped into a problem which has never happened me before. I want to be able to test the site offline, so this prob

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-07 03:56

    Be sure that the image file exists in your computer, and at the correct location.

    Without the leading slash: images/logo.png is a path relative to the css file. If the css file is at /sites/example.com/css/styles.css, the image file must be at /sites/example.com/css/images/logo.png (inside the "css" folder)

    With the leading slash: /images/logo.png is relative to the root folder of the site. If the css file is at /sites/example.com/css/styles.css, the image file must be at /sites/example.com/images/logo.png (inside the website root folder)

提交回复
热议问题