Lesson 9 / 30
Images
Embed images with img, write useful alt text and set width and height to avoid layout shift.
By Rahul Agarwal · 15 years in web development · Updated 1 Oct 2026
The img tag
<img> is a void element — src is the file path, alt is a text description, width/height help layout.
<img src="logo.png" alt="Company logo" width="120" height="40">Always write alt text
alt describes the image for screen readers and shows if the image fails to load — never leave it empty for meaningful images.