Does Mozilla have contradictions about sizes and srcset attributes?

23 views Asked by At

Mozilla in the srcset page says:

If the srcset attribute uses width descriptors, the sizes attribute must also be present, or the srcset itself will be ignored.

However, the same Mozilla in the Responsive images page says:

In this case, sizes is not needed — the browser works out what resolution the display is that it is being shown on, and serves the most appropriate image referenced in the srcset

The more I read it, the more it seems contradictory to me. Are there truly contradictions in Mozilla about sizes and srcset attributes?

1

There are 1 answers

0
smallpepperz On

It says that sizes is required only when the optional width descriptors are used. sizes is used in conjunction with the width descriptors in order to allow the browser to calculate pixel density.

In the responsive images page, it says sizes can be omitted when using the pixel density (x') descriptors, which is just rephrasing the what is said in the description for the srcset` attribute