HTML & CSS
/Advanced
Render Blocking Resources
Definition
Static files (like CSS and synchronous JavaScript) that prevent the browser from rendering any DOM content to the screen until they have been fully downloaded and parsed.
Explain Like I'm New
The browser is a strict rule-follower. If it is reading your HTML top-to-bottom and hits a `<script src="huge-file.js">`, it literally stops painting the screen, downloads the file, runs the entire file, and ONLY THEN continues reading the rest of your HTML. The user stares at a blank white screen the entire time.
Real World Example
This is why JavaScript tags used to be placed at the very bottom of the `<body>` tag. Modern developers put them in the `<head>`, but use the `defer` attribute to tell the browser: 'Keep painting the screen, just download this JS in the background'.
Common Use Cases
- •Improving First Contentful Paint (FCP)
Interactive Example
Interview Questions
basic
- Are CSS files render-blocking by default?
intermediate
- What is the difference between `<script defer>` and `<script async>`?