219k views
3 votes
What tag should be used to display an image in HTML

User Jislam
by
7.0k points

1 Answer

2 votes

Final answer:

To display an image in HTML, use the <img> tag with the required src attribute to specify the image's file path, and the alt attribute for accessibility.

Step-by-step explanation:

To display an image in HTML, you should use the <img> tag. This tag is self-closing, which means it doesn't require an end tag. To insert an image into your webpage, you'll need to include the src attribute to specify the path to the image file, and the alt attribute to provide alternative text for users who cannot view images.

For example, to display an image called 'picture' located in the same directory as your HTML file, you would write:

<img src="picture.extn" alt="Description of image">

Remember to always provide an appropriate alt attribute which describes the content of the image. This is important for accessibility, allowing screen readers to convey the content of the image to users who are visually impaired.

User Nadene
by
8.3k points