Courses / HTML
Free Beginner Web Development

HTML & Web Foundations

Learn how websites are structured from the ground up using HTML. Build real pages while learning elements, attributes, links, images, forms, tables, semantic HTML and more.

24
Lessons
4 Weeks
Duration
21%
Progress

Lesson 6 of 24

14 min learning time

Images

Adding images

The img element displays an image on a webpage.

The src attribute

The src attribute tells the browser where the image is located.

Alternative text

The alt attribute provides a text alternative that is useful for accessibility and when an image cannot load.

Example HTML
<img
    src="images/student.jpg"
    alt="Student learning web development"
    width="400"
>

Practical Exercise

Build it yourself

Add an image to a page and provide meaningful alternative text.

Quick Check

Test your understanding

Which attribute provides alternative text for an image?