Guides

Why my page jumps while loading — 3 causes and how to check

Illustration: a book wedged into the middle of a shelf pushes everything below it down

A painfully familiar symptom: you start reading and the text slides away. You aim at a button and it hops, so your thumb lands on an ad. A second later the page settles down, but the irritation stays.

This isn't "the browser being slow". It's a specific layout defect, it has a name — layout shift — and three causes that cover almost every case. Google even scores it: near-zero shifting is acceptable (below 0.1 for three quarters of visitors), and 0.25 and up is bad.

First: find out what's actually jumping

Don't guess. In Chrome open DevTools, go to the Performance tab and record with a page reload.

The results include a layout shifts track — purple diamonds. Diamond size is proportional to shift size, so the biggest one is obvious. Click it: the browser replays the jump as an animation and highlights the elements that moved.

One trap: DevTools highlights the elements that moved, while the culprit is usually whatever appeared above them. Look past the highlighted text at whatever wedged itself in higher up.

Cause 1. An image with no dimensions (the most common)

The browser doesn't know how big an image is until it downloads it. If the markup doesn't state the size, it treats the image as zero and reserves not a single pixel. The image arrives and shoves everything below it out of the way.

How to check. Find the image tags in your source and see whether they carry width and height attributes. Or run Lighthouse — it has a dedicated "image elements do not have explicit width and height" audit that hands you the list.

How to fix. Set the attributes to the file's real pixel dimensions:

<img src="photo.jpg" width="640" height="360" alt="...">

That is not a hard width. Modern browsers derive the aspect ratio from those numbers and hold the space, while the actual size comes from your styles:

img { width: 100%; height: auto; }

If the dimensions aren't known ahead of time, reserve the space with the CSS aspect-ratio property on the container.

Deferred images deserve a separate note: their version of this is nastier. Such an image arrives not during load but when you scroll to it — so the jump happens right under your finger, mid-sentence. Where to switch that on and where not to is covered in the piece on what lazy loading is.

Cause 2. A block that arrives late and lands in the flow

The cookie bar. A "subscribe" banner. An ad. An embedded video or map. Anything that appears a second later above your content and pushes it apart.

This is the second most common cause and the most annoying: these blocks usually pop in at the top, meaning they shift absolutely everything.

How to check. Reload the page on a throttled network (DevTools, Network tab, pick a slow profile) and just watch. On a slow connection the late arrivals are visible to the naked eye.

How to fix — one of three ways:

  • Reserve the space. Give the container a min-height matching the expected size. Important: if the block never arrives, leave the space empty rather than collapsing it — removing reserved space causes exactly the same jump as inserting content.
  • Take it out of the flow. A cookie bar has no business moving the page: lay it over the content instead.
  • Move it lower. The closer an insertion is to the top of the screen, the more moves. If you can't reserve space, at least push the block further down.

Worth knowing: shifts within 500 ms of a person's tap don't count as a defect — they're expected. Which is why a "Load more" button beats auto-loading on scroll.

Cause 3. The font changes the metrics

While your font downloads, text is drawn in a fallback. When the font lands, letters change width and height — the paragraph reflows and everything under it moves. This happens even when the text is hidden meanwhile: it's still laid out in the fallback font.

How to check. Reload on a throttled network and watch the headings: if the typeface is different at first and then the text reflows and changes height, that's it.

How to fix, in order of effort:

  • Name the fallback explicitly. Write font-family: "Inter", sans-serif, not just "Inter". With no fallback, Chrome substitutes Times — a serif with completely different proportions, which makes the jump as large as it gets.
  • Tune the fallback to match. The size-adjust, ascent-override and descent-override descriptors let you pull the fallback's metrics close enough that the swap is barely visible.
  • Preload the critical font in your markup — then it more often makes it in time for the first paint.
  • Last resort: font-display: optional. The font is only used if it arrived in time; if not, the page simply stays on the fallback — but without the jump.

Why is Lighthouse at zero while real visitors suffer?

Because Lighthouse usually measures the load only, while field data covers the page's whole life. If shifts happen during scrolling or on in-app navigation, a lab test simply never sees them. Hunt them manually by scrolling with the Performance panel open.

It only jumps on mobile — why?

The screen is narrow, so a single wedged-in block displaces a much larger share of what's visible, and the same mistake costs more. On top of that, late elements arrive later on mobile networks. Test on a throttled profile, not on your own Wi-Fi.

Can animation move the layout too?

Yes, if you animate top or left — the browser recomputes layout every frame. Move elements with transform instead: those shifts don't count toward the metric and are cheaper to draw. If your styles aren't applying at all, that's a different story — why your CSS isn't working.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →