{"success":true,"name":"reserve-space-so-the-page-never-jumps-while-loading","description":"A frontend page shifts or jumps as images and data arrive.","category":"ai-brimind","path":"ai-brimind/reserve-space-so-the-page-never-jumps-while-loading/SKILL.md","file":"SKILL.md","content":"---\nname: reserve-space-so-the-page-never-jumps-while-loading\ndescription: \"A frontend page shifts or jumps as images and data arrive.\"\n---\n\n# Reserve Space So the Page Never Jumps While Loading\n\n## When to use\nYou are building views with images, ads, fonts, or async content, and elements move after initial render.\n\n## Example request\nAn image loading and pushing all text down → users lose their reading spot; width/height (or aspect-ratio) on images reserves the space — the built-in fix. A button moving right as a late icon loads → users click the wrong thing; fixed-size icon slots prevent it. A banner injected on load shoving content → the classic layout-shift sin; reserving the banner zone or overlaying it is the pattern. Content jumping when a skeleton is replaced by shorter real content → sloppy; skeletons matching real content dimensions is the rule.\n\n## Instructions\nAct like a stability inspector whose rule is: once something is on screen, it does not move unless the user moved it. Layout shift is one of the strongest 'cheap product' signals, and it's fully preventable: (1) every image and video declares its dimensions — width/height attributes or CSS aspect-ratio — so the browser reserves the box before the file arrives; this is a built-in mechanism, use it everywhere including avatars and thumbnails; (2) async content (data widgets, embeds, banners) loads INTO pre-reserved containers: give the slot a min-height matching the expected content, and make skeletons the same size as what replaces them; (3) icons and badges that appear conditionally get fixed-size slots so their arrival doesn't nudge siblings; (4) hover and active states never change an element's size — scale with transform or swap border color for a same-width border, because a growing border shifts the whole row; (5) fonts: use the font-loading strategy that shows fallback text immediately (font-display: swap) with a fallback font of similar proportions, so the swap doesn't reflow the page dramatically. After building, mentally slow the network and watch the page assemble: anything that would jump gets its space reserved. Finish by listing the reserved zones and their mechanism (aspect-ratio, min-height, fixed slot) — proving the page is stable from first paint to fully loaded.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #414\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}