Performance
Core Web Vitals, caching, images, fonts, network behaviour.
19 topics in this category.
-
Core Web Vitals (LCP, INP, CLS)
RequiredCore Web Vitals measure loading, responsiveness, and visual stability. Hit LCP ≤ 2.5s, INP ≤ 200ms, and CLS ≤ 0.1 at the 75th percentile of real users.
-
Image optimisation
RequiredServe images in modern formats (WebP, AVIF), at the right size for the viewport, with explicit dimensions. Images are the largest payload on most pages.
-
Lazy loading images, iframes, and video
RecommendedNative lazy loading defers off-screen images, iframes, and (recently) video until the user scrolls near them. Use loading="lazy" — but never on the LCP element.
-
Preload, prefetch, preconnect
RecommendedResource hints let you tell the browser what is coming. Preload the LCP image and critical fonts, preconnect to third-party origins, prefetch the next navigation.
-
Cache-Control headers
RequiredCache-Control tells browsers and CDNs how long to keep a response. Use immutable + max-age=31536000 for fingerprinted assets and short or no-cache for HTML.
-
No-Vary-Search response header
RecommendedThe `No-Vary-Search` response header tells browsers and caches that some URL query parameters (tracking, UTM, sort order) do not change the response. The cached entry for the canonical URL is reused for variants — fewer fetches, better prefetch hits, less duplicate work.
-
Compression (gzip, brotli, zstd)
RequiredCompress text responses with brotli where supported, gzip everywhere else. zstd is emerging. Don't compress already-compressed media.
-
Web font loading
RecommendedSelf-host WOFF2 fonts, subset them, preload the critical face, and use font-display: swap so text is readable while the font is still loading.
-
Critical CSS and render-blocking resources
RecommendedInline the CSS needed for above-the-fold content and defer the rest. Render-blocking resources in <head> are the single biggest cause of slow first paint.
-
Script loading — defer, async, module
RecommendedChoose the right script-loading attribute for every <script>: defer for app code, async for independent third-party, type=module for modern code. Bare <script> in <head> is always wrong.
-
HTTP/2 and HTTP/3
RecommendedServe over HTTP/2 at minimum and HTTP/3 where you can. Multiplexing eliminates head-of-line blocking; QUIC removes TCP handshake delays.
-
Speculation Rules
RecommendedTell the browser which links to prefetch or prerender before the user clicks. Done well, navigations feel instant; done carelessly, you burn bandwidth on pages nobody visits.
-
Resource hints overview
RecommendedFive resource hints — dns-prefetch, preconnect, preload, modulepreload, prefetch — cover every stage of the request lifecycle. Pick the right one for the job.
-
View Transitions
RecommendedAnimate between states (same-document) or between pages (cross-document) with a single CSS opt-in. Replaces ad-hoc SPA animation libraries with a platform primitive.
-
Back/forward cache (BFCache)
RecommendedKeep pages BFCache-eligible so back/forward navigation restores them instantly from memory, with no reload, no hydration, and no repaint.
-
Visibility-aware rendering
RecommendedUse `content-visibility` with `contain-intrinsic-size` to skip layout and paint for off-screen content, and Intersection Observer to drive lazy behaviour, instead of scroll and resize listeners.
-
CSS containment
OptionalUse `contain: layout paint style` (or the `contain: content` shorthand) to tell the browser that an element's internals cannot affect the rest of the page, so reflow and repaint stay isolated to that subtree.
-
Scroll-driven animations
OptionalDrive CSS animations from scroll position or element visibility with `scroll-timeline` and `view-timeline`, replacing JS scroll-listener libraries with compositor-thread animation.
-
Scrollbar gutter
RecommendedUse scrollbar-gutter: stable to reserve scrollbar space and stop horizontal layout shift between pages or states that overflow vs. don't.