You want to set Next.js image width to 100% ?
Edgar Hovhannisyan
Technical SEO & Web Development Project Manager | Driving Scalable Growth
It gives error when you want to set the Next.js width to 100% and fill the full height of its container.
For that use this code below in you image file, to avoid errors:
<Image
src={...}
width={0}
height={0}
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
/>
And, of course, will appreciate supporting my blog by this?link – https://www.buymeacoffee.com/edx126
Absolute master!!!!
Director, Creative Technology for the Global Creative Data Group
7 个月I come here every month to copy and paste this code. THX U!