In Srcset with W units, does browser consider full resolution of high pixel density display?

137 Views Asked by At

If I specify srcset only in W units, does the browser consider high pixel density displays full resolution or its scaled down resolution?

For example for this code...

<img srcset=“image-xl.jpg 2560w,   
             image-l.jpg 1200w,   
             image-m.jpg 900w” 

     src=”image_o.jpg” />

...a 2x pixel density display with a real resolution of width 2560 is more likely to trigger the 2560w image load or on the contrary it will trigger the 1200w image load, due to it appearing to the browser as a 1280px width display ?

1

There are 1 best solutions below

0
On

From my tests, it's the former i.e., taking the density into consideration.

2560w in this example.