You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's true. Instead, the library takes pixel density into account.
Here is an example:
< ... data-srcset="images/400.jpg 400w, images/800.jpg 800w, images/1000.jpg 1000w" ... >
If the image is viewed on 2x device and the image width is 400px, then the 800w version will be loaded (2x400=800). If the device is 2.5x then the 1000w version will be loaded (2.5x400=1000).
This makes describing images much easier.
What about a situation where you don't know images sizes, container widths etc. and you have only two image versions - a small one and a 2x-version and just want to automatically display the large one at high density displays?
For this case the other spec definition would make more sense.
When a srcset image is specified with a pixel density descriptor instead of a width descriptor as explained here:
https://webkit.org/blog/2910/improved-support-for-high-resolution-displays-with-the-srcset-image-attribute/
or more detailed in the official spec:
https://html.spec.whatwg.org/multipage/embedded-content.html#width-descriptor
the higher resolution image will be removed from srcset.
For example something like this
will be transformed into this
The text was updated successfully, but these errors were encountered: