Images in HTML
?? Images in HTML
The <img> tag is used to embed images on a webpage.
Basic Syntax
<img src="path/to/image.jpg" alt="Description of image">Important Attributes
| Attribute | Description |
|---|---|
src | URL or path to the image file (required) |
alt | Alternative text shown if image can't load or for screen readers (important for accessibility) |
width | Width of the image (pixels or %) |
height | Height of the image |
title | Tooltip text shown when hovering over the image |
loading | lazy or eager - controls image loading behavior (lazy defers loading) |
Example
<img src="flower.jpg" alt="Red flower in bloom" width="300" height="200">Accessibility Tip
Always include a meaningful alt attribute to help users with screen readers and improve SEO.
Want me to explain responsive images or the <picture> element for different screen sizes?