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.
Syntax
<img src="location of the image" / >
Category
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.
Attributes
Identifiers
language information and text direction
Title
Style
Events
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup.
alternate text
client side image maps
ismap, usemap.
visual presentation
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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HTML img tag example - HTML tutorial | w3resource</title>
</head>
<body>
<p><img src="/images/layout.gif" alt="html img tag example" 266" height="239"></p>
</body>
</html>
Result

View this example in a separate browser window
Previous: HTML base tag and element
Next:
HTML map tag and element
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
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