The Image Tag

The <img> tag is used to insert images into an HTML page.

It is self-closing and, therefore, does not require a closing tag.

However, it requires 2 attributes to function properly:

  • src (source): This specifies the path to the image. It can be a relative path like "image/photo.jpg" or a URL.
  • alt (alternative text): It provides alternative text for the image if, for any reason, it cannot be displayed. This attribute is also crucial for accessibility, allowing screen readers to describe the image to visually impaired users.
Thomas Anderson Identity
Mr. Anderson's ID photo

Let's add Mr. Anderson's photo with:

<img src="images/mr-anderson.jpg" alt="Front photo of Mr. Anderson" />

Now, you need to add this image to the project.

Follow these 3 steps: