1.12 Inline critical CSS
Inline what the first screen needs; defer the rest.
Inline the Critical CSS (above the fold CSS)
Critical CSS is the subset of styles needed to render what is visible before the
user scrolls. Inlined in a <style> block in the <head>, it lets the browser
paint the first screen without waiting for a stylesheet request at all.
The rest loads without blocking.
<head>
<style>
/* Generated at build time: the above-the-fold subset, minified. */
body{margin:0;font:16px/1.5 system-ui}header{height:64px}
</style>
<link rel="preload" href="/main.css" as="style" onload="this.rel='stylesheet'" />
</head>The catch
"Above the fold" is not one thing. It depends on viewport size and differs per template — your homepage hero and article header need different rules. Generating it per breakpoint and per template is where the complexity lives.
Generate it at build time, never by hand. Hand-maintained critical CSS goes stale on the first design change, and the failure is silent: the page still works, just slower or with a flash of restyling.
Many frameworks do this automatically. Check before adding a tool.
When to skip it
If your whole stylesheet is under about 15kB compressed, inline all of it or just let it block. The machinery costs more than it saves.
Critical CSS earns its complexity on large sites with big stylesheets and first-visit traffic. On a small site with returning users and good caching, it is mostly ceremony.