Skip to main content
InterviewHubPRO
Section Overview
Q12

Question 12 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

24%
Web Vitals & Performance (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

Why Image Dimensions (`width`/`height` or `aspect-ratio`) prevent layout shifts.

junior LevelDocker & Containers

In Simple Words: When an image tag has <img src="hero.jpg" width="800" height="400">:

  • The browser calculates the intrinsic aspect ratio ($800/400 = 2:1$).
  • Before the image file finishes downloading over the network, the browser immediately calculates the height and reserves the exact box space in the DOM layout.
  • Surrounding text does not jump when the image pixels finally arrive.