image url in CSS

前端 未结 3 2021
别跟我提以往
别跟我提以往 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:52

    I have had image problems previously, My solution is to use Mac OSX's inbuilt Apache Server. It is very simple to enable, go to System Preferences, Sharing and Tick Web Sharing You can then place files/folders in the Sites Folder in your home folder. To Access these files open your web browser and go to localhost/~Username/ There is an article here that goes into more detail about the process http://www.devarticles.com/c/a/Apache/Using-Apache-and-PHP-on-Mac-OS-X/

    0 讨论(0)
  • 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)

    0 讨论(0)
  • 2021-01-07 03:58

    A colleague had this problem because he wasn't testing on a local web server, he was loading the pages in the browser using file://.

    0 讨论(0)
提交回复
热议问题