HTML img Tag is used to embed or insert images in a webpage, website or html document. HTML img tag is one of the most used html tags.
Table of Contents
Syntax of HTML image Tag
The Syntax of HTML image Tag is shown below, It has only starting tag.
<img src="car.jpg" alt="Black Car" width="500" height="600">
Usage of HTML image Tag
HTML image Tag is used to embed, insert or link an image with html document.
Always define the width of the image for responsive web pages.
The width attribute or CSS can be used to set the width of an image.
HTML image Tag is an inline element.
Example of HTML image Tag
Simple example of HTML image Tag is shown below.
<img src="cat.jpg" alt="Cat" width="500" height="600">
In above example an img tag is used to embed the image of a cat.
The src attribute is used to define the path of the image.
The alt attribute is used to define the image and is also important for the search engine optimization. The term alt stands for alternate and the alt text is displayed if image link is broken.
Browser Support for HTML image Tag
HTML image Tag is supported by all major browsers including Safari and Internet Explorer.
Global Attributes Support in HTML image Tag
The HTML image Tag supports all Global Attributes.
Event Attributes Support in HTML image Tag
The HTML image Tag supports all Event Attributes.
HTML image Tag Video
Watch our video on HTML image Tag.