0

There is an image tag with srcset attribute that looks like this:

<img src="..." srcset="small.jpg 300w, large.jpg 900w" sizes="300px" /> 

On normal 1x dpi screen it loads small.jpg, but on high DPI screens (such as retina) - it loads large.jpg.

Is there some way to make it load small.jpg on high DPI screens?

1 Answer 1

1

This is how srcset works, intentionaly.

If you want to prevent the browser from downloading the relevant image you provide, as your sizes value shows that supporting variable viewport widths is not required in your use case, you should use a simple src without srcset:

<img src="small.jpg" width="300" /> 

But it means you always show the image as 300px wide, and users with screen density above 1dppx might see a low quality rendering.

Could you explain why you want this to happen?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.