◉ANTIGRAVITY LABJP
Articles/App Development
▣ App Development/2026-11-24Advanced

Two Times Inlining CSS Made FCP Slower, and How I Now Decide Per Site Whether to Inline

I inlined CSS into the HTML to clear PageSpeed Insights' render-blocking warning, and FCP got almost a second slower. The font preload had been pushed down to byte 28,672 of the head. Even after fixing the placement, the same change made a second site with 88KB of CSS slower, and I rolled it back. Here is a script that counts byte offsets inside the head, an inliner with a size cap, and the pattern I use on the larger site instead.

Core Web VitalsFCPCSSweb fonts4Next.js10PageSpeed Insightsindie development33Antigravity422

✦ Premium Article

I was running an artist's official site through PageSpeed Insights (PSI) when the "Eliminate render-blocking resources" item showed exactly one entry: the CSS file Next.js had written out. 7.3 KiB, with an estimated saving of 1,260 ms. The site had only a few pages and about 19KB of CSS in total.

Put it all in a <style> tag and that entry disappears — that was my reasoning. I added a small script after the build and measured again. The warning was gone. First Contentful Paint, though, was almost a second slower.

As an indie developer who builds and runs his own sites, I find there is a particular satisfaction in clearing PSI warnings one by one, and it is easy to stop at the screen where the warning vanished. What follows is what caused that delay, the second time I tripped on the same change on a different site, and how I decide now.

The answer first

Inlining CSS can help or hurt depending on two things: where you put it and how big it is.

  • Placement: if you drop the CSS where the original <link rel="stylesheet"> was, the font <link rel="preload"> behind it gets pushed down, and the browser finds the font later. Putting the <style> right before </head> avoids that.
  • Size: on a site with a lot of CSS, the HTML itself gets heavy and FCP got worse even with correct placement. In my notes, it helped on a 19KB site and I rolled it back on an 88KB site.

Neither shows up directly on the PSI screen. The quickest way to see it is to open the built HTML and count the head byte by byte.

First mistake: the font preload sank to byte 28,672

My first script was naive. It looked for <link> tags pointing at /_next/static/css/… in every HTML file under out/, and replaced each one in place with the CSS contents. A single replace — the shortest thing you can write.

Each page grew by 26KB (6KB after gzip). In exchange one CSS request went away, so total transfer was about the same. On paper it should have been faster.

The reason it wasn't was the order of things in the head. In the Next.js export, the CSS <link> comes before the font preload. Dropping 26KB of CSS into that spot pushed the preload back.

How the CSS was insertedByte offset of the font preload
At the original <link> positionbyte 28,672
Right before </head>byte 1,276

Browsers scan ahead in the HTML to start fetching images and fonts early (the preload scanner). If the preload sits 28KB in, it is discovered later. The heavier the font — Japanese faces especially — the more directly that delay lands on FCP.

Because the render-blocking warning was gone, the PSI screen looked like an improvement. The built HTML was the last place I looked when I went hunting for why the number had gone the wrong way.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦When FCP gets worse after inlining CSS, you can count the byte offset of the font preload in the head and tell within minutes whether placement is the cause
✦You can add a build step that measures total CSS before inlining and skips pages over a cap, stopping a change that backfires on large sites before it ships
✦You will know how many PSI runs to take and what to compare when the numbers wobble from run to run, so you can decide whether to roll back
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

▣ App Dev2026-11-12
Check Web Font Delivery with an Origin Header, Too: How a Fallback Font Went Unnoticed on My Site for 13 Days
For 13 days, the Latin web font on my own site kept returning 404 and every page was drawn in a fallback face. A plain curl returned 200; only the browser's request, which carries an Origin header, received the stale 404. Here is a script that compares three kinds of request, a setting that keeps long cache lifetimes off error responses, and how to pick a purge that reaches every variant.
▣ App Dev2026-10-20
I Edited a Sentence and Only the New Characters Turned into Tofu: Adding a Missing-Glyph Check to a Subsetted Japanese Web Font
Change one line of Japanese copy and the newly added characters can render as tofu boxes. Here is a small script that lists every character missing from a subsetted font, with file and line number, and fails the build if even one is absent, with real output from running it.
▣ App Dev2026-10-30
After I Closed the Image Viewer with Esc, the Page Behind It Stopped Scrolling: What I Counted When Moving to the dialog Element
While fixing the full-screen image viewer on my own site, I worked through three problems in order: Esc did nothing, the page behind kept scrolling, and the close button sat on top of the artwork. Even after moving to dialog, one bug remained, with a check script and numbers.