onmyway133 / blog

🍁 What you don't know is what you haven't learned
https://onmyway133.com/
MIT License
669 stars 33 forks source link

How to use nextjs Image #962

Open onmyway133 opened 5 months ago

onmyway133 commented 5 months ago

Fill parent div

A boolean that causes the image to fill the parent element, which is useful when the width and height are unknown.

The parent element must assign position: "relative", position: "fixed", or position: "absolute" style.

<div className="relative">
    <Image src="" alt="" fill objectFit="cover" />
</div>