Marks a resource that would not block on its own (a module, async or script-inserted resource) as render-blocking, so the browser does not paint until it loads.
Overview
The blocking attribute holds the first paint until a resource has loaded. Its only value is render.
Many resources already block rendering without it: a stylesheet that the parser finds in <head> (when its media matches), a <style> in <head>, and a classic <script> in <head> without async, defer or type="module". Adding blocking="render" to them changes nothing.
The attribute matters for resources that would not block on their own:
<script type="module">, which is deferred by default
<script async> and <script defer>
<link>, <style> and <script> elements inserted into <head> by script
<link rel="preload">, <link rel="modulepreload"> and <link rel="expect">
Applies to: <link>, <style>, <script>.
1
<script type="module" src="/js/theme-init.js" blocking="render"></script>
Values
| Value | Meaning |
render | Do not paint until this resource has loaded (for scripts: loaded and run). |
| Absent, empty or unknown tokens (the default) | The element's normal blocking behaviour. |
The value is a space-separated token list, so element.blocking is a DOMTokenList. Feature-detect with element.blocking?.supports('render'), as the demo does.
Examples
A module that must run before first paint
Module scripts are deferred, so the page normally paints before they run. blocking="render" holds the paint until the module has run, without blocking the HTML parser the way a classic script does.
1
<script type="module" src="/js/theme-init.js" blocking="render"></script>
An async script
12
<script src="/js/experiment.js" async blocking="render"></script>
A stylesheet inserted by script
Stylesheets that script adds to <head> do not block rendering. Set the attribute when the page must not paint without them, for example a theme chosen from saved preferences:
12345
const link = document.createElement('link');link.rel = 'stylesheet';link.href = `/themes/${savedTheme}.css`;link.blocking = 'render';document.head.append(link);
This only helps before the first paint, so the script has to run early: a classic or blocking="render" script in <head>.
Wait for an element: rel="expect"
<link rel="expect" href="#id" blocking="render"> holds the first paint until the parser has reached the element with that id. It is mostly used with cross-document view transitions, so the new page does not paint before the elements that animate exist.
1234567
<head> <link rel="expect" href="#main-content" blocking="render"></head><body> <header>…</header> <main id="main-content">…</main></body>
blocking with async and defer
async and defer control when a script runs relative to parsing. blocking controls whether the browser may paint before the resource is ready. They combine:
12345678
<script src="/js/legacy.js"></script> <script src="/js/app.js" defer></script> <script src="/js/framework.js" defer blocking="render"></script>
Render-blocking preload
A rel="preload" hint starts a download early but never blocks. Add blocking="render" when the page must wait for a resource that is used late, such as a font only a script-inserted stylesheet asks for:
12
<link rel="preload" href="/fonts/heading.woff2" as="font" type="font/woff2" crossorigin blocking="render">
The opposite: loading CSS without blocking
A plain <link rel="stylesheet"> in <head> always blocks, so leaving blocking off is not enough to make CSS non-blocking. These patterns avoid blocking:
- A non-matching
media: stylesheets whose media query does not match download at low priority and do not block. This suits print styles.
- Insert it from script: a stylesheet your module adds after load does not block. Pair it with
rel="preload" so the download starts early. Without JavaScript it never loads, so only use this for CSS the page works without.
- Link it in
<body>: a stylesheet linked just before the content that needs it blocks only the content after it in Chromium and Firefox, not the content above it.
123456
<head> <link rel="stylesheet" href="/css/main.css"> <link rel="stylesheet" href="/css/print.css" media="print"> <link rel="preload" href="/css/comments.css" as="style"> <script type="module" src="/js/app.js"></script></head>
In Vanilla Breeze
VB itself does not use blocking, because it is not in Firefox. The docs site avoids a theme flash in every browser with two older tools (site/src/includes/head.html):
- A small classic inline script in
<head> reads the saved theme and writes the theme <link rel="stylesheet"> while the parser is still in <head>, so the stylesheet is parser-inserted and render-blocking on its own.
- A
html:has(link[data-vb-theme-state="loading"]) body { visibility: hidden; } rule keeps the page hidden until that stylesheet's load handler flips the state to ready (or error).
If you only target Chromium and Safari, a script-inserted theme link with link.blocking = 'render' does the same job. See themes for VB's theme loading, and async / defer for how VB's bundles load.
Browser support
blocking="render" on <link>, <script> and <style>: Chrome 105, Safari 18.2; not in Firefox. rel="expect": Chrome 124, Safari 18.2; not in Firefox (November 2026). Browsers without support ignore the attribute, and the resource keeps its default behaviour, so it is safe to add.
Gotchas
- Every render-blocking resource delays first paint. Overusing
blocking="render" hurts First Contentful Paint and Largest Contentful Paint.
- It holds the paint, not the parser. For scripts it does not change execution order. Use
defer or modules for ordered execution after parsing.
- It only matters before the first paint. A resource marked render-blocking after the page has painted has no visible effect.
- Only
render is defined. The token list leaves room for future values.
Related
Which to choose
- Parser-inserted CSS or a classic inline script in
<head> — already render-blocking in every browser; no attribute needed. This is what VB's theme boot uses.
blocking="render" — a module, async, deferred or script-inserted resource that must be ready before first paint, when a Firefox flash is acceptable.
rel="expect" — holding the paint until key markup is parsed, typically for view transitions.