All practice problems Bug of the Day: a new problem every midnight, free for everyone. Keep a streak with your friends.
Frontend Engineering · HTML & CSS · Hard
HTML & CSS practice: Performance Panic
The homepage jumps around while it loads. Google noticed. My nephew ran a Google test. It says our page “shifts layout” while loading and wastes data on…
The problem
- My nephew ran a Google test. It says our page “shifts layout” while loading and wastes data on phones.
- • Stop the page jumping when images load.
- • Don't load the gallery until people scroll to it.
- • But the big hero picture must appear immediately!
- Must pass: Every image declares its width and height.
- Must pass: Gallery images load lazily.
- Must pass: Hero image loads immediately.
You'll use: HTML · CSS · Accessibility · Responsive design · Forms
Solve it (expert level)3–6 min · You write HTML & CSS
Show a hint
Give every <img> width and height attributes matching its size — the browser reserves the space before it loads.
What this teaches (spoiler)
Performance is mostly HTML: declare image dimensions to prevent layout shift, lazy-load what's below the fold, prioritise what's above it, and let images shrink to fit.