HTML & CSS · Middle · Question 19 of 75
Which technique best prevents layout shifts caused by loading images?
- ✓Correct answer: Set
widthandheight(oraspect-ratio) to reserve the space - 2Add
loading="lazy"to every image so they load later - 3Load images only after the
loadevent via JavaScript
Explanation
Knowing the proportions, the browser reserves space before the file loads, so content doesn't jump. Modern browsers compute aspect-ratio from the width/height attributes automatically. Lazy loading without dimensions makes shifts worse, and loading via JS hurts LCP.