Inserting Images in HTML

Learn how to display images on your web pages using the HTML <img> tag and its essential src and alt attributes.

Bringing Pages to Life with Images 🖼️

A picture is worth a thousand words! Images are essential for creating visually appealing web pages. Let's learn how to add them using the `<img>` tag.

Syntax

The <img> tag is self-closing and requires the src attribute to specify the image path and the alt attribute for accessibility.

Purpose

  • Display images and graphics on the web page.
  • Provide visual context to accompany textual content.
  • Improve accessibility with alt descriptions for users with visual impairments.

Practice Zone


Interactive Test 1: Drag & Drop

Arrastra en el orden correspondiente.


Arrastra las opciones:

<img
src="image.jpg"
alt="Description"/>

Completa el código:

______
______
______

Interactive Test 2: Fill in the Blanks

Rellena los huecos en cada casilla.

< src="" alt="">

Practice Example: Code Editor

Create an HTML document that inserts an image using the <img> tag. Make sure to specify a src and an alt attribute.

* Write the code below. Correct characters will be shown in green and incorrect ones in red.

<img src="image.jpg" alt="Description of the image">

Knowledge Check

Which attribute is necessary to display an image in HTML?