Next.js Discord

Discord Forum

Image with src "X" has either width or height modified, but not the other.

Unanswered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Australian Freshwater CrocodileOP
What does this error mean? I couldn't figure it out

11 Replies

Original message was deleted
Australian Freshwater CrocodileOP
                <Image
                  src="/Shape-o-top.svg"
                  width={20}
                  height={20}
                  alt="Divider"
                  className="w-5 pb-6 mt-3"
                />
Like for this code
Australian Freshwater CrocodileOP
I tried removing that className and still not working
warn-once.ts:6 Image with src "http://localhost:3000/Shape-o-top.svg" has either width or height modified, but not the other. If you use CSS to change the size of your image, also include the styles 'width: "auto"' or 'height: "auto"' to maintain the aspect ratio.
Arboreal ant
if you set the with and height i dont think you need it in the classname too
BUt its not solving the problem
Arboreal ant
try just use
<Image
src="/Shape-o-top.svg"
alt="Divider"
className="w-5 pb-6 mt-3"
/>
@Arboreal ant <Image src="/Shape-o-top.svg" alt="Divider" className="w-5 pb-6 mt-3" />
Australian Freshwater CrocodileOP
Not allowed
width and height are required