Category: Websites and UX

Next.js Image Disappears or Resizes Incorrectly

Read this guide in Polish

The picture disappears in the part of breakpoints or looks like an empty rectangle after changing orientation.

Where's the problem coming from?

The image of the fill requires a size and a properly positioned parent. Invalid sizes also lead to an inoptimal download.

What to do step by step?

1. Check the size of the parent and computed height where the image disappears.

2 . For fill set the parent position and actual height or aspect-ratio.

3 . Check with-index, overflow and visibility at breakpoints.

4 . Set sizes according to the actual image width in the project.

5 . Test the slow network, forward and backward navigation and screen rotation.

Correction test and important trap

The image remains visible in all target layouts without rapidly jumping content.

Do not fix this only by adding a high fixed height to all screens.