Next.js Discord

Discord Forum

Nextjs 13 + Image

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
How can I convert my class name to code that does not allow me to not set width and height

<Image
src={slide.image}
alt={Slider Image ${index + 1}}
className="w-full h-auto object-cover rounded-t-lg sm:object-contain"

/>

5 Replies

I not understand what do you mean?
Brown bearOP
I am using Next JS 13, I am attaching this example. @Muhammed Khal
I always get the error that tells me to indicate a width and a height but the problem that the I don't know the exact size in this case.
I don't know how to solve

<Image
src="./image,png"
alt="Eventi immagine"
className="mb-10"
style={{ maxWidth: "100%", height: "auto" }}
/>
<Image
            src="./image,png"
            alt="Eventi immagine"
            className="mb-10"
            width={20}
            height={20}
           
          /> 
Do that
And you can set the height in the className as per you're requirement @Brown bear