Hi! When people say a Next.js SSR form prints missing input borders, it’s usually one of two patterns:
A) Hydration changes the look: the first server-rendered paint shows borders, then after the client hydrates the page, borders become invisible (or “outline: none” wins).
B) Print/PDF looks different: the on-screen form looks fine, but Print Preview / PDF drops borders (often due to @media print rules, color adjustment, or a different CSS cascade during printing).
The tricky part is you can get the same symptom from totally different causes: CSS-in-JS SSR not rehydrating cleanly (Emotion/MUI), a className mismatch between server/client, Tailwind preflight + custom styles fighting, or a print stylesheet overriding borders.
To keep this safe (no “random fixes”), I want to narrow down when the borders disappear. Answer in any order:
1) Do borders look correct on the first paint and then disappear a moment later (classic hydration timing)?
2) Is the issue only when printing / saving as PDF, or also on screen?
3) What styling stack is in play: Tailwind, CSS Modules, MUI/Emotion, styled-components, Chakra, or plain CSS?
Customer
We’re on Next.js with SSR. The form renders fine sometimes, but when we print (or save as PDF) the input borders are missing. Also, we’ve noticed a brief flicker where borders appear then disappear after load.
That combination (print missing borders and a post-load change) strongly suggests the “final” styles after hydration aren’t the same as what SSR initially outputs.
Two quick clarifiers that usually tell us if it’s hydration vs print CSS:
• If you open the page and immediately hit Print Preview, do borders already look missing there, or do they vanish only after the page fully loads/hydrates?
• In DevTools, if you select one input, do you see border: none (or border color matching background) coming from a global reset, component library baseline (e.g., MUI CssBaseline), or a print media rule?
Also: are you using the App Router (app/) or the Pages Router (pages/)? And any CSS-in-JS like Emotion/MUI or styled-components?
Customer
App Router. We use MUI in some places and Tailwind in others (long story). In print preview the borders are usually missing even if on screen they look okay. Sometimes the first paint shows them, then they disappear after hydration.
That’s actually very actionable diagnostically. Mixing Tailwind + MUI/Emotion can be fine, but it increases the chance of CSS order and style rehydration differences between SSR and client.
Here’s the safe logic path I’d use (no code changes yet):
1) Confirm whether “print” is applying different rules
Print preview uses @media print and sometimes different color/contrast behavior. A border can exist but be effectively invisible if its color is too light or if a print rule resets borders for inputs (some teams do this to “clean up” printouts).
2) Confirm whether hydration swaps classNames/styles
If the border appears then disappears, it can be a client-side className replacing the SSR className, or a late-injected stylesheet winning the cascade (Emotion style tags, Tailwind layer order, or component baseline styles).
Fast check: on a “bad” load, can you right-click an input → Inspect → and tell me what the winning CSS is for border in the “Computed” panel? Even just the file/source name helps.
Customer
In computed styles it shows border-width is 0 and border-style is none. The rule looks like it comes from a reset/baseline. In some cases there’s also outline: none. Hard to tell which one wins.
That points away from “printer bug” and toward your CSS cascade being different across states (SSR vs hydrated, screen vs print). A baseline/reset doing border: 0 is common; the real question is why your intended border rule isn’t winning consistently.
A few high-probability culprits in Next.js SSR + hydration scenarios (especially with MUI/Emotion + Tailwind):
• Style injection order: a baseline/reset is loaded later on the client and overrides your form styles after hydration.
• Conditional classes: a theme or mode class (dark/light, density, “focused”, “invalid”) changes after hydration and flips border tokens.
• Print-specific reset: @media print includes a normalization that removes borders to save ink or improve readability.
Before touching any code, can you answer these (quick, but high-signal):
1) Does this happen in all browsers (Chrome/Edge/Firefox) or mainly one?
2) Are the “missing borders” only for certain inputs (MUI TextField vs native input), or everything including selects/textareas?
3) Does the problem show up only on certain routes/components (e.g., pages that are Client Components) or everywhere?
Customer
Mostly Chrome and Edge. It’s worse on pages where we use MUI components. Native inputs sometimes keep borders. It’s not everywhere — more like a few routes.
That “worse on MUI routes” detail matters. With MUI + Emotion, SSR relies on consistent style generation and predictable insertion. If the SSR HTML and the hydrated client tree don’t match, you can see two symptoms at once: a hydration warning (sometimes hidden) and a visual shift where baseline styles win.
For printing, it can be even more noticeable because Chrome’s print pipeline takes a snapshot of styles at a moment in time. If a style tag is injected late, the print result can capture the “wrong” cascade (especially during route transitions).
Diagnostic-only checks I’d do next (safe, no refactors):
• Check the server snapshot: load the page with JavaScript disabled (or view the “server-rendered” HTML) and confirm whether the input borders exist in that state.
• Check hydration warnings: look for “Text content does not match server-rendered HTML” / hydration messages in the console around those routes.
• Check for print CSS: search your styles for @media print rules touching input, fieldset, border, outline, or color adjustment.
When did this start? Was it after upgrading Next.js, MUI/Emotion, or switching routes/components to the App Router?
Customer
It started after a Next.js upgrade and some changes to our layout. We also introduced Tailwind around the same time. We don’t always see hydration warnings, but sometimes we do.
That’s consistent with a “cascade changed” event rather than a single broken component. Tailwind’s preflight/reset + MUI baseline + your own CSS can stack in a way that’s stable on one route and unstable on another (depending on which styles get loaded/injected first).
The key is to collect evidence that shows which layer is removing borders and when it happens. Here’s an IT-friendly capture checklist you can give your team without committing to a fix yet:
Capture checklist (hydration + print border loss)
1) Screenshot Chrome Print Preview on an affected route showing the missing borders (include the URL/path).
2) In DevTools → an affected input → “Computed” → screenshot the winning border/outline rules (especially the file/source of border: 0 or border-style: none).
3) Console screenshot if any hydration warnings appear on that route during load/transition.
4) Note whether the component is MUI TextField (Emotion) or a native input, and whether the route is a Client Component boundary (if your team tracks that).
5) Quick A/B: print the same route after a hard refresh vs after navigating to it client-side (route transition). If results differ, it’s a strong signal of style injection timing.
With those artifacts, you can usually tell if the issue is print media rules, style insertion order, or a genuine hydration mismatch affecting classNames/styles.
Customer
Is there a quick way to tell if the print issue is “print CSS” versus hydration timing without changing code?
Yes—there are a couple of “observation-only” signals that don’t require edits:
Signal 1: Print preview timing
Open a fresh tab → immediately open Print Preview as fast as possible. Then repeat after waiting a few seconds. If borders differ between the two, that points to hydration/style injection timing rather than a static print stylesheet.
Signal 2: Emulate print media
In DevTools you can emulate print media (so the page applies @media print while you inspect). If the borders disappear only under print emulation, you’re likely dealing with a print-specific rule or color/contrast behavior.
Signal 3: Route transition vs hard refresh
If a hard refresh prints differently than navigating to the route client-side, it often indicates CSS-in-JS insertion order or delayed stylesheet loading on hydration.
None of these “fix” it, but they give you a clean direction for what to investigate first.
Customer
Got it. If we confirm it’s hydration / style insertion order, what’s the safest next thing to check before we start rewriting components?
The safest “next check” is to confirm consistency between server and client styling layers—without changing your UI logic yet.
Specifically, I’d verify:
• Whether the routes with missing borders share the same layout wrappers/providers (theme provider, CssBaseline, Tailwind import location). A small difference in where a global style is included can flip cascade order only on certain routes.
• Whether there’s any conditional styling tied to client-only state (prefers-color-scheme, user settings from localStorage, feature flags) that changes classNames after hydration.
• Whether printing happens during a transient state (route transition) where styles are not fully settled yet.
Once you know which of those is true, your team can choose a targeted fix path—without “randomly re-exporting styles” or chasing one-off overrides that might break accessibility (e.g., removing focus outlines everywhere). If you paste the computed-rule sources (just the filenames/origins) from one affected input, it usually becomes obvious which layer is zeroing borders.
Why input borders vanish: hydration mismatch, CSS order, or print media overrides
In a Next.js SSR app, borders can “exist” on the server-rendered HTML and then disappear after the client hydrates if the final CSS cascade changes. Common triggers include CSS-in-JS SSR rehydration differences (Emotion/MUI), Tailwind preflight or a baseline reset applying border: 0, and route-specific provider/layout differences that change style injection order.
Printing adds another layer: @media print can apply different rules, and the browser’s print pipeline can capture styles at a specific moment. If styles are still settling during hydration or a route transition, a form can print without borders even when it looks fine on screen.
How to separate print CSS issues from hydration timing (no risky changes)
If borders are missing only under print preview or print emulation, it’s likely a print stylesheet/reset or contrast behavior. If borders change a second after load, it’s more consistent with hydration/className/style-tag insertion order. Comparing hard refresh vs client-side navigation, and capturing the computed winning border rule on an affected input, is usually enough to choose the correct investigation path.
This avoids “fixes” that accidentally remove focus indicators or introduce new SSR/CSR differences that Bing can flag as unstable rendering.
Next.js print output looks wrong — quick troubleshooting tips
Collect evidence first, then standardize the styling path.
Fast path: check whether borders disappear only in print preview or also after hydration on screen. Inspect one affected input and find which rule wins (border: 0, border-style: none, or a color/token change). Then compare a hard refresh versus a client-side route transition to see if CSS injection timing is involved.
Disclaimer: This information is AI-generated and intended for general guidance only. For advice specific to your Next.js version, router mode, styling stack (MUI/Emotion/Tailwind), and print workflow, please consult a verified expert on Whizz-Tech before changing system settings.
Why do my input borders disappear after hydration in Next.js SSR?
This usually happens when the final client-side CSS cascade differs from what SSR initially rendered. A reset/baseline (Tailwind preflight, MUI CssBaseline, or other global styles) can win after hydration, or CSS-in-JS style insertion order can shift between server and client on specific routes.
Why do input borders go missing only in Print Preview or PDF?
Print uses @media print and can apply different rules than screen styles. Borders may be reset for printing, become too light for print contrast, or the browser may capture styles while the page is still hydrating/transitioning, causing a border-less snapshot.
Why does it happen on some routes but not others in the App Router?
Route-level layouts/providers can change which styles load first and how they’re injected. If one route includes a baseline/reset later (or a different theme/provider setup), it can override borders only on those pages—especially where MUI/Emotion components are used.
What should I send to a developer to diagnose “missing borders” without guessing?
Share (1) a Print Preview screenshot, (2) the computed winning border/outline rules for one affected input (including the stylesheet/source), (3) any hydration warnings from the console, and (4) whether the result changes between hard refresh vs client-side navigation.