Critical rendering path & CSS/JS delivery

Ordering document head resources, eliminating render-blocking scripts, and delivering lean CSS for immediate First Contentful Paint.

How the Browser Constructs a Frame

Before painting pixels, the browser must parse HTML into the DOM, parse render-blocking stylesheets into the CSSOM, combine them into the Render Tree, compute Layout, and execute Paint. Every synchronous stylesheet or parser-blocking script in <head> delays this pipeline.

Optimal <head> Ordering

The sequence of tags inside <head> directly governs parallel network utilization:

  1. <meta charset="utf-8"> and <meta name="viewport" ...>
  2. <title>
  3. preconnect hints for critical third-party origins (such as font or API hosts)
  4. Critical inline <style> (if splitting above-the-fold styles) or primary stylesheet <link rel="stylesheet">
  5. <link rel="preload"> for the LCP hero image or critical WOFF2 font
  6. Deferred scripts (<script src="..." defer> or <script type="module">)

Script Loading Attributes Compared

Attribute Download Execution Timing Blocks HTML Parser?
<script src="..."> Immediate Immediate upon download Yes (avoids)
<script src="..." defer> Parallel After HTML parsing completes, in document order No
<script type="module" src="..."> Parallel Deferred by default, in dependency order No
<script src="..." async> Parallel As soon as downloaded (unordered) Pauses parser during execution

Splitting Non-Critical Stylesheets

Print styles or below-the-fold modal stylesheets should never block initial render:

<link rel="stylesheet" href="/assets/css/print.css" media="print">

Keep your primary stylesheet modular and free of @import rules—CSS @import forces sequential round-trips because the browser cannot discover the imported file until the parent stylesheet finishes downloading and parsing.