-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Closed
Milestone
Description
Bug report
Describe the bug
When using the Image component, the sizes property doesn't work as described in the docs.
When using the Image component, the image is resized to match the container width which is size of the width attributes that we passed, or fit 100% of the viewport if the image is larger than the screen, ignoring the sizes attribute completely.
Example of code:
<Image
width="800px"
height="456.8px"
sizes="(max-width: 500px) 100px"
src="/next.png"
alt="Next.js"
/>To Reproduce
I created a codesandbox example with the exact problem:
- Go to https://codesandbox.io/s/elated-neumann-u81mr?file=/pages/index.js
- Resize the browser window width to be bigger than 500px to see that the image is the size of
width 800pxandheight 456.8px - Resize the browser window width to be smaller than 500px to see that the image will fit to 100% of the screen, not respecting the
sizesprop that should tell the image to be100px
Expected behavior
I expect the image to have exactly a 100px when the view port is smaller then 500px, respecting the sizes attribute.
Screenshots
System information
- OS: Ubuntu 20.04
- Browser: Chrome
- Version of Next.js: 10.0.0
- Version of Node.js: v12.18.3
LauraBeatris, mpetricek, mnikolaus, DoctorDerek, yulev5 and 3 moredanilo-vieira, ardaerzin, haydencleary, collegewap, LauraBeatris and 3 more
Metadata
Metadata
Assignees
Labels
No labels

