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
I know I shouldn't do it, but I'm using same images with same aspect ratio and format, but with different sizes, in different elements as escamotage to prevent mobiles with pixel density above 2 to download a too big image - as I know that a double sized image is enough even for pixel density 3 and above and so I can have a better performance. In this way I can have more granular control. Other way, I see in Chrome DevTools that a mobile DPR3 viewport 36o width is downloading a too big image instead of the 720 width image that I want to serve (360x2=720).
This specific problem of mobiles with a major pixel density that makes browsers to download a too big image, while a double sized is just enough for the human eye even with DPR 3 and above, is discussed here. But for now it seems that there is no final solution for the problem: whatwg/html#4421
So, I wonder, my escamotage is that bad? It may cause problems with different borwsers? As I've seen that in Chrome DevTools works perfectly, even if Lint is hurting my feelings. What do you think?
It seems the image 720.webp shows the same contents as 856.webp does and it has the same aspect ratio and format.
It seems the image 720.jpg shows the same contents as 856.jpg does and it has the same aspect ratio and format.
The <source> element should only be used for art direction and format-based selection. For providing multiple resolutions of the same image use the srcset attribute instead. More information on CSS-Tricks.
The text was updated successfully, but these errors were encountered:
I don’t know any problems/bugs with this pattern. The only problem is that resizing the browser might cause an unnecessary download of another image, but that is negligible I think.
…even if Lint is hurting my feelings. What do you think?
I’m not a huge fan of it, but I think it’s perfectly fine if you know that it is a tradeoff.
But there is also a different approach that you can use: One <source> with (min-resolution: 2.3dppx) that loads the images in the correct resolutions but with a lower quality level. See also #13 (comment)
Hello it's me again,
I know I shouldn't do it, but I'm using same images with same aspect ratio and format, but with different sizes, in different elements as escamotage to prevent mobiles with pixel density above 2 to download a too big image - as I know that a double sized image is enough even for pixel density 3 and above and so I can have a better performance. In this way I can have more granular control. Other way, I see in Chrome DevTools that a mobile DPR3 viewport 36o width is downloading a too big image instead of the 720 width image that I want to serve (360x2=720).
This specific problem of mobiles with a major pixel density that makes browsers to download a too big image, while a double sized is just enough for the human eye even with DPR 3 and above, is discussed here. But for now it seems that there is no final solution for the problem: whatwg/html#4421
So, I wonder, my escamotage is that bad? It may cause problems with different borwsers? As I've seen that in Chrome DevTools works perfectly, even if Lint is hurting my feelings. What do you think?
Here's my code:
And here's Lint:
The text was updated successfully, but these errors were encountered: