HTML & CSS interview question

Your page's Cumulative Layout Shift (CLS) score is poor. How do you find and fix the shifts?

Scenario Asked in Frontend Engineer · Full Stack Engineer interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Find which elements move and when (Lighthouse "avoid large layout shifts", the Performance panel's layout-shift track, or the web-vitals library's attribution in real-user data), then reserve space for them: width and height or aspect-ratio on images, iframes and ads, placeholders for content loaded later, and font loading that doesn't reflow text.

Keep reading with a membership

The full answer with examples, key points and comparisons is part of the membership, along with every other interview answer, progress tracking and Daily Review. Most-asked answers stay free to read.

See plans and free trial Already a member? Sign in

More HTML & CSS questions

← All HTML & CSS questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake