English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML: <img> src attribute

The required src attribute specifies the URL of the image, when the web page is loaded; at that time, the browser retrieves the image from the web server and inserts it into the page.

 HTML <img> tag

Online Examples

Image tags are as follows:

<!DOCTYPE html>
<html>
<head>
<title>HTML: <img> src attribute - Basic Tutorial Site oldtoolbag.com</title>
<body>
<img src="haha.gif" alt="haha face" width="42" height="42">
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the src attribute.

Definition and Usage

The required src attribute specifies the URL of the image.

Note: When a webpage loads; that is when the browser fetches the image from the web server and inserts it into the page. Therefore, make sure that the image is actually located in the same position relative to the webpage, otherwise your visitors will get broken link icons. If the browser cannot find the image, it will display a broken link icon.

HTML 4.01 With HTML5Differences

None.

Syntax

<img src="URL">

Attribute value

ValueDescription
URLImage URL.
Possible values:
Absolute URL  - Points to another website (such as SRC = "http:")//www.example.com/image.gif"
Relative URL  - Points to a file within a website (such as SRC = "Image.gif")
 HTML <img> tag