Next.js Discord

Discord Forum

fill prop in Next/image didn't take parent height

Answered
MyMy posted this in #help-forum
Open in Discord
I want to image stretch to parent element so i'm using fill prop in Next/image element but it's not take parent height
How can i make it take parent height?

Here's my code:
<div className="relative h-full w-full">
      <Swiper slidesPerView={1}>
        {images.map((image) => (
          <SwiperSlide key={image}>
            <Image
              src={`/manga/1/chap-1/${image}`}
              fill={true}
              alt={image}
            ></Image>
          </SwiperSlide>
        ))}
      </Swiper>
    </div>
Answered by MyMy
for those who use swiper framework. Make sure swiper container take parent width and height
View full answer

5 Replies

And here's what it show
Ruddy Duck
Try applying a fixed number for the parent’s height and width
it still not work
i get it
for those who use swiper framework. Make sure swiper container take parent width and height
Answer