问题描述
<img class="sealImage" alt="Image of Seal" src="file:///C:/Users/Anna/Pictures/Nikon%20Transfer/SEALS%20PROJECT/j3evn.jpg">
这不显示图像,只显示alt。
但是如果我去
That doesn't display an image, just the alt.But if I go to
file:///C:/Users/Anna/Pictures/Nikon%20Transfer/SEALS%20PROJECT/j3evn.jpg
在浏览器中显示图像。
我正在xampp上托管这个,现在在Windows机器上。
I'm hosting this on xampp, on a windows machine right now.
我尝试过不同的浏览器,用和没有%20的空间,但我知道这是正确的方法。(实际上它适用于两者)
I've tried different browsers, and with and without %20 for space, but I know that with is the correct way.(It worked with both, actually)
我知道图像只会在托管它的机器,这不是问题。
And I know the images will only be visible on the machine that's hosting it, that's not a problem.
推荐答案
您的文件需要位于您的www目录中。例如,如果您在Windows上使用wamp服务器,则应找到j3evn.jpg,
Your file needs to be located inside your www directory. For example, if you're using wamp server on Windows, j3evn.jpg should be located,
C:/wamp/www/img/j3evn.jpg
你可以通过html访问它
and you can access it in html via
<img class="sealImage" alt="Image of Seal" src="../img/j3evn.jpg">
查找属于您的Web服务器的www,public_html或html文件夹。将所有文件和资源放在该文件夹中。
Look for the www, public_html, or html folder belonging to your web server. Place all your files and resources inside that folder.
希望这会有所帮助!
这篇关于HTML图像不显示,而src网址有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!