HTML5 Images
HTML
What is an Image in HTML5?
In HTML5, you use the <img> tag to embed images (like PNG, JPG, GIF, SVG) into a web page.
It’s an empty tag, meaning it doesn’t have a closing tag — all information goes inside the opening tag.
Attributes
| Attribute | Description | 
|---|---|
src | URL or path to the image file. | 
alt | Text description for screen readers & in case the image fails to load. | 
width | Width of the image (pixels or %). | 
height | Height of the image (pixels or %) | 
title | Tooltip text shown on hover. | 
Absolute vs Relative Paths
Absolute path:
Full URL to an external image.
Relative path:
Path relative to your HTML file’s location.
Responsive Images
Use CSS or attributes like width="100%" so images adapt to screen sizes.
Why use alt?
- Helps screen readers describe images to visually impaired users.
 - Shown when the image doesn’t load.
 - Improves SEO (search engines read alt text).