-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expands image when no size is set #6
Comments
Hey, so the original image |
I have a layout like this, where the blue block is an image and the gray blocks are text. The markup could be like If I then change the markup to be In fact, when I use Chrome, which has built in support for srcset, the first layout is correctly shown, because Chrome deals with the intrinsic size properly. The easy fix is to change this to explicitly state the size: |
Also, to more directly answer your question, this is only happening when my screen density is 2, because the polyfill is correctly downloading the 2x image and effectively turning the img into |
Great explanation, I know exactly what is happening. Thanks, it's a nice edge case to have under consideration, thank you. |
When using
<img src="logo.png" srcset="logo.png 1x, [email protected] 2x" alt="logo">
without an explicit width or height attribute, the image is expanded to double its size, instead of staying the same size.For example, if
logo.png
is 100×50 and[email protected]
is 200×100, I would expect my<img>
element to stay 100×50 instead of becoming 200×100.The text was updated successfully, but these errors were encountered: