Skip to content

Rule · Performance

Images without width/height or aspect-ratio

perf/images-missing-dimensionswarnvoid perfupdated

Why it matters

Without intrinsic dimensions the browser reserves 0px and shifts the layout when the image loads.

How to fix it

Add width and height attributes (CSS can still scale with height:auto) or set aspect-ratio in CSS.

Example

tsx
<img src="/card.avif" width="640" height="360" style="height:auto" alt="…">

References

void perf reports 25 rules in this category. Core Web Vitals and bytes: LCP, CLS, TBT, TTFB, JavaScript, CSS, fonts, images, caching and compression, measured as the median of several runs on a throttled mobile and a desktop profile.