Web Fundamentals

Critical Rendering Path

Web Fundamentals Map

Rendering & Browser Architecture

Critical Rendering PathScript Loading Patterns (async/defer)Event Loop Deep DiveJavaScript Module Systems (CJS, ESM, UMD)Dynamic Module Loading (import())Import on InteractionImport on VisibilityBrowser Rendering Pipeline & Layout ThrashingRendering Strategies (CSR, SSR, SSG, ISR)Streaming SSR & Progressive HTMLIslands ArchitectureReact Server ComponentsFramework Reactivity (React, Vue, Svelte, Solid)HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)DNS Resolution & TTL Caching

Performance

Core Web Vitals: LCP, INP, CLSPerformance Optimization Trade-offsCritical Resource PrioritizationCode Splitting & Dynamic ImportsTree Shaking & Dead Code EliminationLazy LoadingResource Hints: Preload, Prefetch & PreconnectText Compression: Gzip & BrotliImage & Video OptimizationAdaptive LoadingList VirtualizationWeb Workers vs Main ThreadMemory Leaks: Detection & PreventionManaging Third-Party ScriptsHow CDNs WorkHTTP Caching Deep DiveService Workers & Offline StrategyPWA Fundamentals

Security

Cross-Site Scripting (XSS)Cross-Site Request Forgery (CSRF)CORS ExplainedCORS Preflight, Credentials & MisconfigurationsContent Security Policy (CSP)Why is HTTPS Secure? (TLS/SSL)Authorization Best PracticesCookie Security & Session Hardening

State & Data Architecture

State Management Guide (Context vs Zustand vs Redux)React Query & Server State CachingData Fetching PatternsCaching StrategiesPagination: Offset vs Cursor-BasedReal-time Communication (WebSocket, SSE, Polling)
mediumWeb Fundamentals

Critical Rendering Path

Learn the interview-ready mental model, practical trade-offs, and production patterns for this web fundamentals topic.

Topic content

TL;DRHTML → DOM + CSSOM → Render Tree → Layout → Paint → Composite
Very High Signal
Google
Meta
Netflix
30-Second Answerstart every interview with this

The Critical Rendering Path is the sequence the browser follows to turn HTML, CSS, and JavaScript into pixels on the screen. The interview-safe version is: HTML parsing builds the DOM, CSS builds the CSSOM, both combine into the Render Tree, followed by Layout (geometry), Paint (pixels), and Composite (GPU layers).

The browser is a factory. Raw materials (HTML bytes) enter → get shaped into parts (DOM & CSSOM) → assembled into a blueprint (Render Tree) → positioned (Layout) → painted (Paint) → finally put together on the screen by the GPU (Composite).

HTML Bytes
Parser + Preload Scanner
DOM + CSSOM
Render Tree
Layout → Paint → Composite
Pixels on Screen

1Step 1 — HTML Parsing & DOM Construction

The browser starts parsing HTML incrementally as soon as bytes arrive. A preload scanner runs in parallel to discover CSS, JS, fonts, and images early.

index.htmlhtml
<script src="app.js"></script>          <!-- parser-blocking -->
<script async src="app.js"></script>       <!-- loads parallel, executes ASAP (unordered) -->
<script defer src="app.js"></script>       <!-- loads parallel, executes after parse -->

2Step 2 — CSS Parsing & CSSOM Construction

CSS is render-blocking by default. The browser needs the CSSOM before first paint.

3Step 3 — Render Tree Construction

Combines DOM + CSSOM. Excludes non-visual nodes and adds pseudo-elements (::before, ::after).

4Step 4 — Layout (Reflow)

Calculates geometry. Expensive. Avoid layout thrashing (e.g. reading offsetHeight after style changes).

5Step 5 — Paint

Fills pixels (text, backgrounds, borders, images).

6Step 6 — Composite

GPU combines layers. Cheap for transform & opacity.

Key Takeaways
  • ✓Simplified CRP (interview answer): DOM + CSSOM → Render Tree → Layout → Paint → Composite
  • ✓CSS blocks rendering. Synchronous JS blocks parsing.
  • ✓async = parallel + immediate execution (unordered). defer = parallel + after parsing.
  • ✓Animate transform/opacity → stays in Composite stage.
  • ✓Batch reads/writes to avoid layout thrashing.
PreviousNext

Topic Guide

On this page