Components

Image fill

With fill, the image occupies its positioned parent. Reserve the parent space using CSS and set objectFit to suit the content. Supply sizes reflecting the actual rendered width. Source: https://nextjs.org/docs/app/api-reference/components/image. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
<Image fill ... />

Working Example

Example Snippetnextjs
import Image from 'next/image';export default function Cover(){return <div style={{position:'relative',width:'100%',maxWidth:240,aspectRatio:'2 / 3'}}><Image src='/covers/moss.png' fill sizes='(max-width: 240px) 100vw, 240px' alt='Moss book cover' style={{objectFit:'cover'}}/></div>;}
Next.js Reference