Jump to content

How to make cell phone browsers choose smaller image, and desktop choose bigger image when their resolutions are the same

Recommended Posts


I do not know how to make cell phone browsers choose the smaller image, and the laptops/desktops choose the bigger image, while their resolutions are the same.

I have the following script:

<img sizes="(max-width: 479px) 479px,
            (max-width: 991px) 991px,
            srcset="media/img/small.webp 479w,
                    media/img/medium.webp 991w,
                    media/img/big.webp 1400w"

From the above script, when the cell phone's resolution is, let's say 1080 x 1920 pixels, then the browser will choose big.webp.

How to make the cell phone's browser choose small.webp?

Thank you

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...