HTML Code for Img tag

Introduction to IMG tag in HTML

The <img> tag in HTML is used to insert an image onto a webpage. It is a self-closing tag, which means it does not have a closing tag.

Attributes of the IMG tag

1. src: It specifies the path to the image. 2. alt: It provides alternative text for an image, in case the image cannot be displayed. 3. width: It sets the width of the image in pixels or percentage. 4. height: It sets the height of the image in pixels or percentage.

Example Code

<img src="image.jpg" alt="Description of the image" width="300" height="200" />

Go from files to website in seconds.

Start a free trial for 7 days — no credit card required

Get Started for Free