What is the primary purpose of the alt attribute on an informative image?
- To set the image's display width.
- To control how the browser compresses the image.
- To provide a text alternative for the image's relevant information.
- 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?
alt="decorative image"alt="image"- Omit the alt attribute completely.
alt=""
Question 4: Image Dimensions
Why should developers specify accurate width and height attributes on images when possible?
- They guarantee that the image will never fail to load.
- They help the browser reserve layout space and reduce unexpected layout shifts.
- They automatically convert JPEG images into WebP.
- 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.
- True
- False
Question 6: Choosing an Image Format
Which format is specifically designed for vector graphics that can scale without ordinary raster pixelation?
- JPEG
- GIF
- SVG
- PNG
Question 7: Lazy Loading
Where is loading="lazy" generally most appropriate?
- On every image, regardless of its position.
- On images far below the initial viewport that do not need to load immediately.
- Only on the first visible hero image.
- 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.
- The img element is a void element and must not contain child elements.
- Meaningful alt text should describe the image's purpose in context.
- Displaying an image at a small CSS width always guarantees a small downloaded file.
- 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.
- True
- False