1

可能是我,也可能是我的 Mac Book Pro、10.8.5、Safari 6.0.5。我不能在我的 HTML 中使用相对路径。我有文件夹 A。在文件夹 AI 中有一个图像文件夹;我的 index.html 代码也在文件夹 A 中。但我编码:

<img src="images/photo.jpg" alt="Something" />

我得到带有白色问号的蓝色方块;找不到图像。如果我在 Windows 机器上,我对相对路径没有问题。如果有人有任何想法,请告诉我。

4

1 回答 1

2

enter image description hereRelative paths should work just fine. I just tested your example, and the image loaded without issue.

Why does it work on my Mac, and not yours?

Things to try:

  1. Check your file and folder names carefully for typos
  2. Make sure file extensions are not hidden ( Finder > Preferences > Advanced > Show all filename extensions )? Maybe your jpeg is actually 'photo.jpg.jpg'
  3. Reload the page in Safari ( Shift + Click on the refresh button )
  4. Test with an alternate jpeg image to rule out issues with the file system.
于 2013-10-17T23:34:16.993 回答