Interview Question

How do you reduce CLS (layout shifts)?

Reserve space early so page content does not jump.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

Reduce layout shifts by saving space before content loads. • Set image width and height, reserve ad space, and avoid adding content above what the user is reading. • Prefer native HTML elements before adding custom scripted behavior. • Test the result with a keyboard, a small screen, and browser developer tools.

💡 Simple Example

<img src="photo.jpg" width="800" height="450" alt="Classroom">

⚡ Quick Revision

Reserve space early so page content does not jump.