Adding an image from a url - html

2020-07-09 03:12发布

I am having trouble displaying an image from the internet on my html page.

The line is:

<img src="http://www.somepic..." alt="pic" />

What is wrong with it? Does that only work with images that are on my disk?

Thank you

标签: html image
1条回答
forever°为你锁心
2楼-- · 2020-07-09 03:54

Based on the URL you've presented in the comments above, my guess is that you're not actually linking to an image, you're liking to a web page but mistaking it for an image.

For instance, the url you provided:

http://www.google.co.il/imgres?q=picture&hl=iw&sa=X&rlz=1C1SKPL_enIL452IL452&tbm=isch&prmd=imvnsl&tbnid=BAlLxbccyZkwSM:&imgrefurl=http://animal.discovery.com/mammals/cheetah/&docid=qDOKJbIkYvvzyM&imgurl=http://animal.discovery.com/mammals/cheetah/pictures/cheetah-picture.jpg&w=625&h=450&ei=Y-grT8_ZNYnntQb4kID0DA&zoom=1&iact=hc&vpx=693&vpy=191&dur=850&hovh=190&hovw=265&tx=155&ty=84&sig=110318714666115395229&page=1&tbnh=141&tbnw=183&start=0&ndsp=19&ved=1t:429,r:1,s:0&biw=1280&bih=656

Is the URL of a webpage showing the image, not the image itself.

Make sure you're linking to the actual image itself:

<img src="http://animal.discovery.com/mammals/cheetah/pictures/cheetah-picture.jpg" 
alt="Cheetah!" />
查看更多
登录 后发表回答