img tag
<Img> (Image Tag)
Explanation
Img tag is used to insert an image in a webpage.
<img src="Image Source" />
Element Specific attributes supported by this tag are:
| Attribute | Value | Description |
| src | url | It is necessary. It mentions the URL of an image. |
| height | pixels | Indicates the height of an image |
| width | pixels | Indicates the width of an image. |
| ismap | ismap | Denotes an imge as server side image map. |
| alt | text | It helps to provide title for an image. It is mandatory. |
| usemap | #mapname | Defines an image as a client side image map. |
Example Code:
Result :
- The attributes "src & alt" must be included in the <img>.
- It is necessary to apply proper closing for this tag.
It is available in previous versions of the HTML.
It supports both
Global Attributes and
Event Attributes in HTML5.
Limitations:
It is applicable to all major browsers.