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:
| Attribute | Description |
|---|---|
src | URL/path to the image file (required) |
alt | Alternative text for accessibility (recommended) |
width | Width of the image (optional) |
height | Height of the image (optional) |
title | Tooltip text on hover (optional) |
Example:
<img src="https://via.placeholder.com/150" alt="Placeholder Image" width="150" height="150">

