A flash of unstyled content (FOUC) is a visible rendering defect in which the browser briefly paints a page with default browser styles before the intended stylesheets have loaded or been applied, after which the layout abruptly snaps into its designed form. Users see plain serif text, unstyled links and stacked elements for a fraction of a second or longer.
In web performance, FOUC matters because it degrades perceived quality, can trigger layout shifts that worsen Cumulative Layout Shift, and often signals a problem in how CSS is delivered. It is closely related to render-blocking resources and critical CSS, but it is the opposite failure: FOUC appears when styling is not blocking enough at the moment the browser decides to paint.
Why browsers show unstyled content
Browsers produce a FOUC when they have enough DOM to paint but have not yet built the CSS object model that should style it. Normally, a stylesheet linked in the document head is render-blocking: the browser parses HTML, discovers the stylesheet and postpones the first paint until the CSS has downloaded and been parsed. FOUC occurs whenever that guarantee is bypassed.
The bypass usually happens in one of three ways. Styles may be injected later by JavaScript, a stylesheet may be loaded asynchronously on purpose for speed, or a stylesheet may be placed in the body so that content above it renders first. Historically, some browsers also painted before head stylesheets arrived, which is how the term entered web development vocabulary in the early 2000s.
The table below lists the most common technical causes and the mechanism behind each.
| Cause | Mechanism | Typical context |
|---|---|---|
| JavaScript-injected styles | CSS is added after the first paint | CSS-in-JS without server rendering |
| Asynchronous stylesheet loading | Stylesheet no longer blocks rendering | Preload or media swap patterns |
| Stylesheet placed late | Content before the link renders unstyled | Links inside the body |
| Client-side hydration | Server HTML lacks the styles the client adds | Single-page application frameworks |
| Late theme switching | Dark or light class is set after paint | Theme read from local storage |
FOUC and its relatives
FOUC belongs to a family of flash-type rendering artifacts that share one pattern: the browser paints an intermediate state that the designer never intended. Distinguishing them matters because each has a different cause and fix.
| Artifact | What the user sees | Underlying cause |
|---|---|---|
| FOUC | Page without its stylesheet | CSS applied after first paint |
| FOUT | Fallback font replaced by web font | Font swap after download |
| FOIT | Invisible text until the font loads | Font blocking period |
| Theme flash | Light page flashing before dark mode | Theme class set by late script |
| Hydration flash | Content changes after JavaScript runs | Server and client output differ |
A flash of unstyled text (FOUT) is often confused with FOUC, but it is narrower: the layout is styled and only the typeface changes. Developers frequently accept FOUT deliberately with font-display: swap, whereas a full FOUC is almost never an acceptable trade-off.
Impact on Core Web Vitals and user perception
FOUC primarily harms Cumulative Layout Shift (CLS), because elements move when styles change their size and position after the first paint. A heading that grows from default size to a large display size, or a navigation list that collapses into a horizontal bar, can each push the content below it and add measurable shift.
Its effect on paint metrics is less direct. Asynchronous CSS can make First Contentful Paint (FCP) earlier, which is why some optimization guides introduce FOUC by accident: the metric improves while the experience gets worse. Largest Contentful Paint may also be recorded on an unstyled element and then again after restyling.
Beyond metrics, FOUC damages trust and brand perception. Users interpret a broken-looking page as a sign of an unreliable site, and on slow mobile connections the unstyled state can last several hundred milliseconds or more, long enough to be clearly noticed.
How to prevent a flash of unstyled content
Preventing FOUC means ensuring that styles needed for the first viewport are available before the first paint, while keeping the remaining CSS from delaying rendering more than necessary. The balance is between FOUC on one side and slow, render-blocked pages on the other.
- Link essential stylesheets in the document head and keep them render-blocking.
- Inline critical CSS for above-the-fold content and load the rest asynchronously.
- Use server-side rendering of styles when CSS-in-JS libraries are involved, so styles arrive with the HTML.
- Set theme classes with a small blocking inline script in the head, before the body renders.
- Avoid placing
linkelements inside the body unless the content they style comes after them.
The decision table below matches typical situations with a prevention strategy.
| Situation | Recommended approach | Reason |
|---|---|---|
| Static site with one stylesheet | Keep the head link blocking | Simplest reliable guarantee |
| Large stylesheet, slow networks | Inline critical CSS, defer the rest | Fast first paint without FOUC |
| React app with CSS-in-JS | Extract styles during server rendering | Styles ship with the HTML |
| User-selectable dark mode | Inline theme script in the head | Theme is known before paint |
| Third-party widget styles | Reserve space with fixed dimensions | Limits visible shift |
A last-resort technique hides the document with visibility: hidden until styles load. It removes the flash but can produce a blank screen if a script fails, so it should include a timeout fallback and is rarely the best solution.
Diagnosing FOUC in practice
FOUC is diagnosed by observing the paint sequence under realistic network conditions rather than on a fast development machine, where it is often invisible. Throttling the connection to a slow 3G or 4G profile in browser developer tools usually reveals it.
Useful methods include filmstrip views in performance panels and synthetic monitoring tools, which show each painted frame, and the Layout Shift regions overlay, which highlights elements that move. Real user monitoring that reports CLS by page template helps identify templates where late styles affect actual visitors.
The idea in brief
A flash of unstyled content is like walking into a shop a moment before the decorations go up. For an instant, the visitor sees bare shelves and plain signs, and then everything suddenly appears in place.
On a website, this means the text and pictures show up first in a plain, default look, and only then jump into the intended design. It usually lasts less than a second, but it looks broken and can make things move under the reader’s finger. The fix is to make sure the design instructions arrive before the page is shown.
A practical scenario
An online furniture retailer moves its storefront to a single-page application that uses a CSS-in-JS library without server-side style extraction. After launch, mobile visitors on slower connections report that product pages look broken for a moment, and field data shows CLS rising from 0.04 to 0.21, well above the 0.1 threshold for a good score.
A filmstrip recorded with a throttled 4G profile shows about 400 milliseconds of unstyled HTML: the product title appears in default serif type and the image gallery as a vertical list. The front-end team enables server-side style collection so that each rendered page carries its CSS in the head, and adds a blocking inline script that applies the saved theme.
After deployment, the flash disappears from the filmstrip and the 75th percentile CLS falls back to 0.05 within four weeks of field data, while First Contentful Paint stays essentially unchanged.