looks good: a" /> looks good: a" /> looks good: a"/>

width and height img attribute values for devices with devicePixelRatio > 1 - should they be changed?

23 views Asked by At

For devices with window.devicePixelRatio == 1

<img src="http://example.com/100x100.jpg" alt="image 100 by 100" width="100" height="100">

looks good: an image 100 by 100 pixels is used for the square of 100 by 100 - good.

For devices with window.devicePixelRatio == 2 (a better quality of the image can be used for the same dimensions) what value supposed to be for width and height attributes - 100 or 200?

<img width="100" height="100" src="http://example.com/200x200.jpg" alt="image 200x200 for 100px by 100px">

or

<img width="200" height="200" src="http://example.com/200x200.jpg" alt="image 200x200 for 100px by 100px">

Should the img width and height attribute values be also updated based on window.devicePixelRatio or they should NOT be changed?

I can't find any clear information on this simple and basic question.

0

There are 0 answers