Latest web development tutorials

HTML img src attribute

HTML img tag Reference Manual HTML <img> tag

Examples

Image labeled as follows:

<img src="smiley.gif" alt="Smiley face">

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the src attribute.


Definition and Usage

src attribute src tag is required. It sets URL of the image.

Note: When a page is loaded, the browser to obtain images from a Web server, and insert it into the page.Therefore, ensure that the image associated with the page at the same point, otherwise the visitor may get a broken link icon. If the browser can not find the image will display a broken link icon.


Differences between HTML 4.01 and HTML5

no.


grammar

<img src="URL">

Property Value

描述
URL 图像的 URL。

可能的值:

  • 绝对 URL - 指向另一个网站(比如 src="http://www.example.com/image.gif")
  • 相对 URL - 指向网站内的一个文件(比如 src="image.gif")


HTML img tag Reference Manual HTML <img> tag