Dev.Lib
arrow_backBack to Blogs
LEVEL_011.4June 27, 20261 min read

Critical rendering path

Frontend Fundamentals

HTML → DOM, CSS → CSSOM, combined render tree → layout → paint → composite.

Summary

HTML → DOM, CSS → CSSOM, combined render tree → layout → paint → composite. Render-blocking CSS/JS delays first paint; @import and sync scripts in <head> extend the path. Identify what blocks LCP element discovery (fonts, hero image, lazy hydration). Inline critical CSS; defer/async non-critical JS.

Code example

<head>
  <link rel="stylesheet" href="/critical.css" />
  <link rel="preload" href="/hero.webp" as="image" fetchpriority="high" />
  <script src="/app.js" defer></script>
</head>

Key points

  • HTML → DOM, CSS → CSSOM, combined render tree → layout → paint → composite.
  • Render-blocking CSS/JS delays first paint; @import and sync scripts in <head> extend the path.
  • Identify what blocks LCP element discovery (fonts, hero image, lazy hydration).
  • Inline critical CSS; defer/async non-critical JS.

Further reading

Related concepts