HTML img tag and element

1. HTML img (image) element embeds an image in an HTML document.

2. The img element is an empty element. It starts with <img> tag and does not have any end tag.

3. The value of the src element of img element holds the URI representing the location of the image.


<img src="location of the image" / >


HTML img element is a part of HTML object, image and applet.

Whether both start and end tags are required

Start tag is required but end tag is forbidden.

Can contain

HTML img element can contain any other elements.

Can reside within

HTML img element can reside within Inline elements, Block-level elements except pre.



id, class.

language information and text direction

lang, dir.






onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup.

alternate text


client side image maps

ismap, usemap.

visual presentation

align, width, height.

Supported doctypes

HTML 4.01 Strict, HTML 4.01 Transitional, and HTML 4.01 Frameset.

Example of using HTML img element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HTML img tag example - HTML tutorial | w3resource</title>
<p><img src="/images/layout.gif" alt="html img tag example" 266" height="239"></p>


html img element

View this example in a separate browser window

HTML img tag example.

Previous: HTML base tag and element
Next: HTML map tag and element

Test your Programming skills with w3resource's quiz.

Follow us on Facebook and Twitter for latest update.

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook