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
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.
More HTML & CSS questions
- What is ARIA, and what is the first rule of ARIA?
- What input types and validation attributes did HTML5 add?
- What is the alt attribute for, and what makes good alt text?
- What is HTML5, and how is it different from HTML 4?
- What is semantic HTML, and why does it matter?
- What is the difference between script, script async and script defer?
- What is HTML?
- Compare localStorage, sessionStorage and cookies.