HTML Images
Images can improve the design and the appearance of a web page.
The HTML <img> tag is used to embed images in a web page. Images are not inserted — they are linked from a source URL.
The <img> tag is self-closing (no end tag needed) and has two required attributes:
src— the path or URL to the image filealt— a text description shown if the image fails to load
Try It — Images with src, alt, and sizing
Preview
Image Attributes Reference
| Attribute | Required? | What it does |
|---|---|---|
src | ✅ Yes | Path or URL to the image |
alt | ✅ Yes | Fallback text if image fails to load |
width | No | Sets image width in pixels |
height | No | Sets image height in pixels |
Tip: Always include the
altattribute! It improves accessibility for screen reader users and helps search engines understand your content.