Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML img src attribute

HTML src property

HTML img Tag Reference HTML tag

Example

The image is marked up as follows:

Smiley face

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the src property.


Definition and Usage

The src attribute of the tag is required. It specifies the URL of the image.

**Note:** When a web page loads, the browser fetches the image from the web server and inserts it into the page. Therefore, make sure the image is in the same location as the related web page, otherwise visitors may get a broken link icon. If the browser cannot find the image, it displays a broken link icon.


Differences between HTML 4.01 and HTML5

none.


Syntax

Attribute values

Value Description
URL The URL of the image.

Possible values:

  • Absolute URL - points to another website (such as src="http://www.example.com/image.gif")
  • Relative URL - points to a file within the website (such as src="image.gif")
  • |

    HTML img Tag Reference HTML tag