Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the CSS needed for the first viewport small and available immediately; load genuinely non-critical stylesheets after that initial render. CSS that applies to the current page is render-blocking by default, so simply moving it later can trade a faster first paint for unstyled content or layout shifts.

Why CSS blocks rendering

The browser builds a CSS Object Model (CSSOM) from stylesheets before it renders content that depends on those styles. A stylesheet link whose media condition matches the current environment can therefore hold up the first render. This is why a stylesheet may appear in Lighthouse’s render-blocking resources audit. The audit identifies a possible bottleneck; it does not mean every stylesheet should be deferred. web.dev explains CSS render blocking, and the HTML Standard defines stylesheet link behavior.

A stylesheet with a media condition that does not currently match can still download, but it need not block the current render. For example, print styles are not needed for a screen render. These techniques change when CSS is applied and can affect fetch priority; they do not eliminate the stylesheet’s network transfer. See MDN’s media-query loading guidance.

Choose what belongs in the initial render

Keep critical CSS small

Put only the rules required to render the initial viewport—such as essential layout, visibility, and typography—in a small inline block or a very small critical stylesheet. Keep the rest in external files. Avoid duplicating large portions of your main CSS inline: critical CSS should be limited to what prevents an unstyled or visibly incomplete first screen.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<style>
  /* Only layout and styling needed for the initial viewport. */
  .header { display: flex; }
  .hero { min-height: 20rem; }
</style>
<link rel="stylesheet" href="base.css">

Remove unused rules and minify and compress production CSS to reduce the bytes that must arrive. MDN covers these approaches in its CSS performance guidance. Critical CSS needs maintenance: revisit it when templates, breakpoints, or above-the-fold components change.

Keep conditional styles conditional

Use a media attribute when a stylesheet applies only in a particular situation. The browser can fetch a non-matching stylesheet without waiting to apply it for the current screen, then apply it when its condition becomes true.

<link rel="stylesheet" href="print.css" media="print">
<link rel="stylesheet" href="mobile.css" media="screen and (max-width: 480px)">
<link rel="stylesheet" href="orientation.css" media="(orientation: portrait)">

Choose conditions that match the stylesheet’s real purpose. Check that print, narrow-screen, and orientation styles activate when appropriate, including after a viewport change. Do not assign a restrictive media condition merely to make a stylesheet stop blocking: if it is needed for the current presentation, it belongs in that render path.

Defer CSS that is not needed for the first screen

Preload, then apply as a stylesheet

For a broadly applicable stylesheet that is not needed for the initial viewport, preload can start fetching it early. Preload alone does not apply CSS; the load handler changes the link to a stylesheet once the file arrives. Keep the noscript fallback so the file remains available when JavaScript is disabled.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<link rel="preload"
      href="non-critical.css"
      as="style"
      onload="this.onload=null;this.rel='stylesheet'">
<noscript>
  <link rel="stylesheet" href="non-critical.css">
</noscript>

Use this only for CSS whose late application will not leave the first screen incomplete. Styles that change geometry, hide content, or alter typography can cause a flash of unstyled content (FOUC), layout shifts, or late text reflow when applied after the first render. Chrome’s Lighthouse guidance for render-blocking resources recommends inlining critical styles and loading the remainder asynchronously.

Use a non-matching media value as an alternative

Another common pattern begins with a media value that does not match the current screen, then switches it after the file loads:

<link rel="stylesheet"
      href="non-critical.css"
      media="print"
      onload="this.media='all';this.onload=null">
<noscript>
  <link rel="stylesheet" href="non-critical.css">
</noscript>

Like preload followed by an onload handler, this delays application, not transfer. Use it only when the stylesheet is genuinely non-critical; otherwise it can introduce visible styling changes. The media behavior is described in web.dev’s render-blocking CSS guidance and MDN’s conditional loading guidance.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Prevent avoidable stylesheet discovery delays

When an imported stylesheet can be linked directly from the HTML, prefer a regular stylesheet link. A link in the document can be discovered by the preload scanner earlier than a stylesheet that the browser must first fetch and parse to find through CSS @import. MDN discusses this in its stylesheet-link documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check that the change improves the page

  1. Confirm what is critical. Check that the initial rules cover the first viewport at the page’s target breakpoints.
  2. Inspect a cold-load network waterfall. Verify the deferred file is discovered promptly and applied after the critical rendering path.
  3. Look for visual regressions. Check for FOUC, layout shifts, and font-related reflow while the page loads.
  4. Test conditional styles. Verify print, orientation, and narrow-screen files activate when their media conditions become true.
  5. Test without JavaScript. Confirm the noscript fallback still loads the deferred stylesheet.
  6. Recheck after significant CSS changes. Use Lighthouse or DevTools after major template or bundle updates, but treat the audit as a diagnostic rather than a rule to defer every stylesheet.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.