Performance: Critical CSS extraction strategies
HIGH IMPACT
This concept affects the page's initial load speed by optimizing how CSS is delivered and rendered for above-the-fold content.
/* Extract critical CSS manually or via tool */ <style> /* Inline only critical CSS here */ </style> <link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="styles.css"></noscript>
@import 'full-styles.scss'; /* All styles loaded in one big CSS file */
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full CSS loaded upfront | Minimal DOM impact | Triggers 1 reflow after full CSS load | High paint cost due to blocking | [X] Bad |
| Critical CSS inlined + async load | Minimal DOM impact | Single reflow after critical CSS paint | Lower paint cost, faster visible content | [OK] Good |