Next.js · Junior · Question 38 of 75

What do you pass to <Image> for an image that stretches over the whole parent block?

Explanation

When dimensions aren't known in advance, use fill: the image is absolutely positioned and fills the parent, which must be relative, absolute or fixed. sizes hints how wide the image will be so the browser doesn't download a file that's too large. Fitting is controlled with object-fit.

Further reading

Problem with a question

Next.js · Junior · question 38

Test yourself

Take the Next.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz