HTML <img> src Attribute

❮ HTML <img> tag

Example

<img src="img-boy.jpg" alt="Boy" width="300" height="200">

Meaning

The src attribute specifies the URL of an image file to be displayed.

The src mandatory for the <img> element.


Standard Syntax

HTML: <img src="URL" alt="text">,
XHTML: <img src="URL" alt="text" />



Browser Support




Status







Attribute Values

Value Description
URL

Value can be

  • An absolute URL - file within or another web site ( href="http://www.example.com/image.png")
  • A relative URL - file within a web site ( href="image.png")
❮ HTML <img> tag