onmyway133 / blog

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

How to use nextjs Image #962

Open onmyway133 opened 10 months ago

onmyway133 commented 10 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>