如何使HTML与图片链接? [英] How to make a picture link with HTML?
问题描述
< a href ='feed.php'> < img src =C:\xampp\htdocs\Project\Icons\Feed.png/>< / a>
但是我的网页上没有图片,为什么?
(我目前只在本地使用我的页面!)
这是因为您(正在尝试)使用本地文件引用。
使用相对路径
或
< a href ='feed.php'>< img src =file:/// C:/ xampp / htdocs / Project / Icons / Feed .PNG/>< / A>
请注意,如果您打算使用'online',它将因LOCAL参考而失败。
如果您通过网络服务器加载页面,您应该使用:
< a href ='feed.php'>< img src =/ Icons / Feed.png/>< / a>
或
< a href ='feed.php'>< img src =http://yoursite.local/Icons/Feed.png/>< / a>
或者图片的路径。
我宁愿使用相对路径(第一个),但它使您能够将页面移动到另一个域,而不会造成链接/图像中断。
I have made a picture link with this code snip:
<a href='feed.php'><img src="C:\xampp\htdocs\Project\Icons\Feed.png"/></a>
But no picture appears on my page, why?
(I'm currently only using my page locally!)
It's because you (are trying to) use a local file reference.
Either use the relative path
or
<a href='feed.php'><img src="file:///C:/xampp/htdocs/Project/Icons/Feed.png"/></a>
Please be aware that if you plan to use this 'online' it will fail because of the LOCAL reference.
If you load the page through your webserver you should use:
<a href='feed.php'><img src="/Icons/Feed.png"/></a>
Or
<a href='feed.php'><img src="http://yoursite.local/Icons/Feed.png"/></a>
Or whatever the path to the image is.
I would prefer the relative path (the first) though which enables you to move your page to another domain without your links / images breaking.
这篇关于如何使HTML与图片链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!