1.

In an image tag, what is the benefit of the srcset attribute?

Answer»

srcset is utilized when we wish to GENERATE several RESOLUTIONS of the exact IMAGE on several devices. This improves the UI. The browser will display low resolution on low-end devices, and high resolution of an image on high-end devices.

Example:

<img srcset="picture_low.jpg 480w, picture_high.jpg 800w" sizes="(max-width: 600px) 480px, 800px" src="picture_high.jpg" alt="Elva dressed as a fairy">


Discussion

No Comment Found