How To Use Image In HTML?

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" />




Image Src
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.


Image Alt
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.


Image Width
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.


Image Height
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.


Supporting Browsers

Element  Chrome  Firefox  Opera  Safari  IE
<img> Yes Yes Yes Yes Yes

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn Affiliate MarketingGet Free book of Affiliate Marketing, SEO Guide

Get Free PDF Book of Affiliate Marketing & SEO guide