Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Working with Images in HTML | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
HTML Basics for Absolute Beginners (Sliced) - 1768407373666

bookWorking with Images in HTML

Images improve the visual appeal of a webpage and help communicate information. In HTML, images are added using the <img> tag.

Inserting Images

The <img> tag is self-closing and requires at least two attributes:

  • src: the image file location;
  • alt: alternative text for accessibility or when the image fails to load.
<img src="image.jpg" alt="Description of the image">

Image Attributes

  • src: path or URL of the image (required);
  • alt: fallback text and accessibility description;
  • width: sets the image width;
  • height: sets the image height;
  • title: shows a tooltip on hover.
index.html

index.html

copy
  • The <img> tag inserts an image onto a web page;
  • The src attribute specifies the source URL of the image file;
  • The alt attribute sets the alternative text for the image;
  • The width attribute sets the image width;
  • The height attribute sets the image height;
  • The title attribute provides further information about the image.

1. What tag is used to insert images into an HTML document?

2. Which attribute is required for the <img> tag to display the image?

3. What does the alt attribute provide for an image?

4. What happens if the image specified in the src attribute cannot be loaded?

question mark

What tag is used to insert images into an HTML document?

Select the correct answer

question mark

Which attribute is required for the <img> tag to display the image?

Select the correct answer

question mark

What does the alt attribute provide for an image?

Select the correct answer

question mark

What happens if the image specified in the src attribute cannot be loaded?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 17

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

bookWorking with Images in HTML

Glissez pour afficher le menu

Images improve the visual appeal of a webpage and help communicate information. In HTML, images are added using the <img> tag.

Inserting Images

The <img> tag is self-closing and requires at least two attributes:

  • src: the image file location;
  • alt: alternative text for accessibility or when the image fails to load.
<img src="image.jpg" alt="Description of the image">

Image Attributes

  • src: path or URL of the image (required);
  • alt: fallback text and accessibility description;
  • width: sets the image width;
  • height: sets the image height;
  • title: shows a tooltip on hover.
index.html

index.html

copy
  • The <img> tag inserts an image onto a web page;
  • The src attribute specifies the source URL of the image file;
  • The alt attribute sets the alternative text for the image;
  • The width attribute sets the image width;
  • The height attribute sets the image height;
  • The title attribute provides further information about the image.

1. What tag is used to insert images into an HTML document?

2. Which attribute is required for the <img> tag to display the image?

3. What does the alt attribute provide for an image?

4. What happens if the image specified in the src attribute cannot be loaded?

question mark

What tag is used to insert images into an HTML document?

Select the correct answer

question mark

Which attribute is required for the <img> tag to display the image?

Select the correct answer

question mark

What does the alt attribute provide for an image?

Select the correct answer

question mark

What happens if the image specified in the src attribute cannot be loaded?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 17
some-alt