Arrange the big night’s rundown: plain, async, defer or module scripts, the stylesheet and critical CSS; the real order from a frame, the first paint on a…
Why it matters
Render-blocking resources are the most common cause of a page staying white too long. Giving scripts defer and inlining the critical CSS often cuts the first paint from seconds to hundreds of milliseconds, felt at once in FCP and LCP.
The key idea
CSS holds the paint, scripts hold the parser
Common mistakes
The page stays white a long time even on a fast connection Every plain script in the <head> stops the parser before the body is read, so the screen stays white. Give it defer (or move it to the end of <body>) so the parser keeps going.
A script sometimes runs first, sometimes last, though it is asyncasync guarantees no order: whichever arrives first runs first. When the order matters, use defer: it runs after parsing, in HTML order.
The HTML gets heavy and uncacheable because all the CSS is inlined Inline only the critical CSS (the top of the page). Keep the rest in its own file loaded without holding the paint, so it can be cached and the HTML stays light.
Try it in this playground
Give both scripts defer The parser stops no more: the title is painted as soon as gaya.css arrives.
Move the scripts to the end of <body> The body is read before the parser stops for the scripts.
Use media="print" on gaya.css It holds no paint, but nor does it apply on screen.
Turn on critical CSS in a <style> The title is styled at the first paint, waiting for no file.