Working 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
- The
<img>tag inserts an image onto a web page; - The
srcattribute specifies the source URL of the image file; - The
altattribute sets the alternative text for the image; - The
widthattribute sets the image width; - The
heightattribute sets the image height; - The
titleattribute 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?
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 17
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Fantastiskt!
Completion betyg förbättrat till 2.86
Working with Images in HTML
Svep för att visa menyn
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
- The
<img>tag inserts an image onto a web page; - The
srcattribute specifies the source URL of the image file; - The
altattribute sets the alternative text for the image; - The
widthattribute sets the image width; - The
heightattribute sets the image height; - The
titleattribute 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?
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 17