Render-Blocking Resources
Why CSS and JavaScript in <head> delay page rendering and how to eliminate render‑blocking resources to improve Core Web Vitals.
Render-blocking resources are stylesheets and scripts that the browser must load and process before it can start painting the page. They directly increase First Paint and Largest Contentful Paint.
What blocks rendering
The main culprits are synchronous resources in <head>:
- External stylesheets (<link rel="stylesheet">).
- Synchronous scripts (<script src="…"> without defer or async).
- Nested @import statements in CSS.
The browser pauses page construction until these files are loaded and processed, making users see a white screen longer.
How to fix CSS
The best approach is to inline critical CSS (styles for the visible area) inside a <style> tag and load the main file asynchronously:
<style>/* critical CSS */</style>
<link rel="preload" href="styles.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="styles.css"></noscript>Media queries also help: files intended only for print or large screens are not considered render‑blocking for the initial view.
How to fix JavaScript
Add the defer attribute for scripts that must execute after HTML parsing, or async for independent ones (analytics, counters). Example:
<!-- defer – recommended for most cases -->
<script src="app.js" defer></script>
<!-- async – for scripts that don't affect the DOM -->
<script src="analytics.js" async></script>How to detect render‑blocking resources
Run PageSpeed Insights or Lighthouse and look for the “Eliminate render‑blocking resources” audit. In Chrome DevTools, the Network panel shows red bars in the waterfall for requests that block the initial render.
Common questions
Discuss your project?
Share your goals and website context — I will suggest a practical next step.