Learn HTML – Part 6 – Image Tag

Understanding the <img> Tag in HTML (Image Tag)

The <img> tag is used to embed images in an HTML document. It is an empty tag (does not have a closing tag) and requires the src attribute to specify the image source.

Tag Syntax:

<img src="image.jpg" alt="Description of image">

Attributes:

AttributeDescription
srcURL/path to the image file (required)
altAlternative text for accessibility (recommended)
widthWidth of the image (optional)
heightHeight of the image (optional)
titleTooltip text on hover (optional)

Example:

<img src="https://via.placeholder.com/150" alt="Placeholder Image" width="150" height="150">

Workbook:

Facebook
WhatsApp
Twitter
LinkedIn
Pinterest

Leave a Comment

Your email address will not be published. Required fields are marked *

About Author
Willaim Wright

Voluptas feugiat illo occaecat egestas modi tempora facilis, quisquam ultrices.

Scroll to Top