Skip to content

Courses / HTML5 Mastery: Complete Beginner to Advanced Course / HTML Images

669 people viewed this

HTML Images

What is the primary purpose of the alt attribute on an informative image?

  1. To set the image's display width.
  2. To control how the browser compresses the image.
  3. To provide a text alternative for the image's relevant information.
  4. To force the browser to download the image immediately.

Question 3: Decorative Images

Which is the appropriate alt attribute for an image that is purely decorative and adds no meaningful information?

  1. alt="decorative image"
  2. alt="image"
  3. Omit the alt attribute completely.
  4. alt=""

Question 4: Image Dimensions

Why should developers specify accurate width and height attributes on images when possible?

  1. They guarantee that the image will never fail to load.
  2. They help the browser reserve layout space and reduce unexpected layout shifts.
  3. They automatically convert JPEG images into WebP.
  4. They guarantee that every image is displayed at its original pixel dimensions.

Question 5: True or False

Setting an image's HTML width attribute to 200 guarantees that the browser downloads a source image only 200 pixels wide.

  1. True
  2. False

Question 6: Choosing an Image Format

Which format is specifically designed for vector graphics that can scale without ordinary raster pixelation?

  1. JPEG
  2. GIF
  3. SVG
  4. PNG

Question 7: Lazy Loading

Where is loading="lazy" generally most appropriate?

  1. On every image, regardless of its position.
  2. On images far below the initial viewport that do not need to load immediately.
  3. Only on the first visible hero image.
  4. On images that must be displayed before any other page content.

Question 8: Multiple Correct Answers

Which statements about HTML images are correct? Select all that apply.

  1. The img element is a void element and must not contain child elements.
  2. Meaningful alt text should describe the image's purpose in context.
  3. Displaying an image at a small CSS width always guarantees a small downloaded file.
  4. The picture element can provide alternative image sources.

Question 9: True or False

An image used as the only content of a link should have alternative text that communicates the link's purpose or destination.

  1. True
  2. False

Question 10: Image Performance

Rate this course

5.0 · 1 rating

Stars show on this course. Your written note stays private.

Your stars