# Next.js: Image with src "https://example.com/a.jpg" must use "width" and "height" properties or "fill" property

**Code:** `Image with src must use "width" and "height" properties or "fill"` · **Category:** Next.js · **Seen on:** Next.js, React

`next/image` needs dimensions (or `fill`) for remote images so it can reserve space and avoid layout shift.

## Meaning

Provide `width` and `height` props, or `fill` with a positioned parent (`position: relative`) and `sizes`. For local imports Next reads dimensions automatically. `fill` requires the parent to have `position: relative|fixed|absolute` and a size.

## Common causes

- Remote image without dimensions
- `fill` used but parent not positioned/sized
- Dynamic image without known size
- Passing string src instead of static import
- width/height set to 0

## Quick fix

1. `<Image src={url} width={800} height={600} alt="" />`
2. Or `fill` + wrapper `relative` with a defined size
3. Add `sizes` for responsive images

## Detailed fix by platform

### Next.js

1. `<div style={{position:"relative",width:"100%",aspectRatio:"16/9"}}><Image src={url} alt="" fill sizes="100vw" /></div>`

## How to diagnose

1. **Dimensions** — width/height or fill?
2. **Parent** — Positioned and sized?
3. **Source** — Static import?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nextjs/image-missing-width-height)
