Skip to content

Loading speed, web and servers

srcset

In short and in plain language

With srcset, a page gives the browser several sizes of an image.

The browser picks the file that suits the screen.

For this it also needs to know how wide the image is on the page. Without that, it often loads files that are too big.

Definition
The srcset attribute gives the browser several versions of an image in different widths. Together with the sizes attribute, the browser picks the file that fits the display size and pixel density. If sizes is missing or set wrongly, the browser may load larger files than needed.

Related terms