1. Home
  2. Computer Science MCQs
  3. HTML
  4. What is the purpose of the srcset attribute on an element?

Added 2 Nov 2026

What is the purpose of the srcset attribute on an <img> element?

  1. To offer image files for different screen sizes Correct answer
  2. To load several images as a slideshow
  3. To set the image's colour profile
  4. To list backup URLs if the server is down

Correct answer

A. To offer image files for different screen sizes

17 views

MCQSEXAM

Explanation

srcset, often with sizes, lets the browser pick the best image for the device's width and pixel density, saving data on phones while staying sharp on retina screens.

Reference

Asked in: NTS, Web Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More HTML MCQs

Practise all HTML MCQs

Similar MCQs