Working with Images in HTML

Table of contents

No heading

No headings in the article.

To add an image to your HTML page, you can use the <img> tag.

The <img> tag is a self-closing tag, which means you don't need to add a closing tag.

The src attribute specifies the URL of the image file you want to display.

<img src="image.png" />

You can also specify the size of the image using the height and width attributes.

<img src="image.png" width="300" height="300" />

If you want to add alternative text for the image, in case the image cannot be displayed the alternative text will display, you can use the alt attribute.

<img src="image.png" alt="user image" width="300" height="200" />

You can also add a caption or title to the image.