HTML Images

This HTML tag will teach you how to add an image to a web page.

HTML provides a way to display images on a web page using the <img> element. The <img> element is a self-closing tag, meaning it doesn't require a closing tag, and has the following syntax:

<img src="image_file.jpg" alt=" description of image">

The src attribute specifies the source of the image, which can be a URL or a file path. The alt attribute provides a text description of the image, which is used for accessibility purposes, such as for users with visual impairments who use screen readers.

It is also a good practice to include the width and height attributes to specify the dimensions of the image, as this can improve the loading speed of the page.

Here's an example:

<img src="my_image.jpg" alt="A beautiful landscape" width="500" height="300">

This will display an image with the file name "my_image.jpg", a description of "A beautiful landscape", and dimensions of 500 pixels wide by 300 pixels high.

Last updated