The HTML img tag is used to show images on the web page. We can insert images by using HTML img tag, closing tags are not used in HTML image elements.
Below is an example of HTML image.
<h2>HTML Image Example</h2> <img src="india_gate.jpg" alt="India Gate" />
It is an important attribute that represents the source of the image. It tells the browser where is the image on the server. We can use image sources from the same directory or can use an external source through image links.
The alt attribute defines an alternate text for the image, It is very important for SEO perspective because google can not read images, so alt tells google what kind of image it is. In another way, the alt attribute describes the image in words.
It is an optional attribute that is used to specify the width to display the image. It is not recommended now. You should apply CSS in place of the width attribute.
We can define the height of the image. The HTML height attribute also supports iframe, image, and object elements. It is not recommended now. We can apply CSS in place of the height attribute.