Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk7 min

How to Fix Puppeteer Screenshots with Missing CSS Styles

When Puppeteer screenshots look unstyled, trace stylesheet and font requests, wait for the app’s real ready state, and verify HTML URLs and viewport settings.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a Puppeteer screenshot is missing CSS, first find out whether the stylesheet or font loaded, then check whether the page was captured before its app finished rendering. Also verify request interception, HTML and asset URLs, viewport, and media conditions. Page.screenshot() captures the browser’s rendered page; it does not restore stylesheets or fonts that failed to load or were blocked.

1. Check whether CSS and font requests succeeded

Start with evidence from the page, not the screenshot call. Log failed requests, response statuses for stylesheets and fonts, and browser console messages. A failed CSS request, an aborted font request, or an error in app code can leave a page looking unstyled even when the screenshot succeeds.

As an Amazon Associate I earn from qualifying purchases.

If request interception is enabled, inspect every branch of its handler. Puppeteer’s Page API notes that intercepted requests stall until the handler continues, responds to, aborts, or completes them through cache. A handler that forgets to continue a stylesheet request can therefore prevent it from loading. Check the resource type and URL before changing the capture timing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.on('requestfailed', request => {
  console.error('Request failed:', request.resourceType(), request.url(), request.failure()?.errorText);
});

page.on('response', response => {
  const request = response.request();
  if (['stylesheet', 'font'].includes(request.resourceType())) {
    console.log('Asset response:', response.status(), request.resourceType(), response.url());
  }
});

page.on('console', message => {
  if (message.type() === 'error') console.error('Page console:', message.text());
});

These listeners help identify failures; they do not by themselves prove that all styles required by the page loaded. For a protected stylesheet, investigate the endpoint’s access rules and whether the page needs cookies or headers. Those are possibilities to verify, not causes that can be inferred from a screenshot alone.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

2. Wait for the page’s actual ready state

Puppeteer’s screenshot guide demonstrates navigating with waitUntil: 'networkidle2' before taking a screenshot. It is a useful baseline, but network activity becoming quiet does not prove that a stylesheet succeeded or that a client-rendered app has finished applying its final classes and styles.

After navigation, wait for a meaningful selector or other page-specific state if the application injects styles or content asynchronously. For example:

await page.goto(url, { waitUntil: 'networkidle2' });
await page.waitForSelector('[data-page-ready="true"]');
await page.screenshot({ path: 'page.png' });

Replace [data-page-ready="true"] with a condition the application actually exposes. For a page that keeps connections open, a selector or state check may be more useful than waiting for network idle. Avoid starting with an arbitrary sleep: it can mask a failed request or incorrect readiness condition without fixing it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Check how the HTML and stylesheet URLs are supplied

When navigating to a URL

Navigating to the live page lets it load in its normal URL and origin context, but still verify the response and the stylesheet and font requests. Check whether the stylesheets are reachable and whether the app has finished rendering before capture.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

When using page.setContent()

Confirm that the supplied HTML contains its style block or stylesheet link, and inspect whether each linked asset URL resolves in the context created for that content. Relative URLs can behave differently when you supply markup than when you navigate to the site; verify the actual requested URL rather than assuming it points to the intended asset.

To isolate a stylesheet-loading problem, add known CSS directly:

await page.setContent('<main class="sample">Check styling</main>');
await page.addStyleTag({ content: '.sample { color: red; font-size: 24px; }' });
await page.screenshot({ path: 'styled.png' });

If this renders with styling, investigate the original linked stylesheet and its URL or loading path. Puppeteer also supports adding a stylesheet by path or URL through page.addStyleTag(). Chrome Developers’ headless-rendering example shows another diagnostic approach: inspect stylesheet responses and replace matching links with equivalent inline <style> content. Inlining is a useful isolation test, not a substitute for fixing a broken production asset path.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Set the intended viewport and device before navigation

Responsive CSS can produce a different layout at a different viewport width, and device emulation can affect the conditions a page sees. Set the viewport before opening the page; Puppeteer notes that changing it after load can reload a page in some cases and recommends emulating before navigation.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await page.goto(url, { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'page.png' });

Use the viewport and device settings that match the intended capture. If the page’s responsive rules depend on touch capability or user agent, use the relevant device emulation rather than changing only the viewport dimensions.

5. Check media conditions and CSS logic

If CSS loaded but the page still looks different from the expected result, check whether the relevant rules apply under the current media conditions. Puppeteer exposes page.emulateMediaType(); its API reference discusses choosing screen media before PDF generation. For a screenshot, treat this as a targeted check when the page’s media-dependent CSS is implicated—not as a default fix or evidence that screenshots use print styles.

Then inspect the rendered DOM and computed styles in the browser context:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Does the expected element exist?
  • Does it have the class or state that activates the rule?
  • Does the expected property appear in its computed styles, or is another rule overriding it?
  • Did application code report an error before applying the class or injecting the stylesheet?

If the resources loaded and the expected rules are present, this is more likely a selector, cascade, or app-state issue than Puppeteer removing CSS.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

6. Use a diagnostic baseline script

This example combines a viewport set before navigation, the official screenshot-guide navigation pattern, and request and console logging. Set url to the page you need to capture, and replace the readiness selector with one that exists on that page if its app finishes rendering after navigation.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1280, height: 800 });

    page.on('requestfailed', request => {
      console.error('Request failed:', request.resourceType(), request.url(), request.failure()?.errorText);
    });

    page.on('response', response => {
      const request = response.request();
      if (['stylesheet', 'font'].includes(request.resourceType())) {
        console.log('Asset response:', response.status(), request.resourceType(), response.url());
      }
    });

    page.on('console', message => {
      if (message.type() === 'error') console.error('Page console:', message.text());
    });

    const url = 'https://example.com';
    await page.goto(url, { waitUntil: 'networkidle2' });
    // If needed, wait for a page-specific ready condition here:
    // await page.waitForSelector('[data-page-ready="true"]');
    await page.screenshot({ path: 'page.png' });
  } finally {
    await browser.close();
  }
})();

The example is a diagnostic starting point, not a guarantee that a particular site will load successfully. Check the logged URLs and statuses, and use the page’s real readiness condition where needed.

7. Troubleshoot by symptom

Symptom Likely area to check Next step
Stylesheet or font request fails or is aborted Network access or request interception Inspect the failed URL and resource type; ensure the interception handler takes an action for each needed request.
Screenshot is unstyled only when using supplied HTML Missing link or inline style, or an asset URL that does not resolve as intended Inspect the markup and requested URLs; test with page.addStyleTag() or inline CSS.
Some app styles or classes are missing, but requests look successful Capture occurred before app-specific rendering completed Wait for a selector or state that represents the finished page.
Page is styled but layout differs from expectation Viewport, device emulation, or media-dependent rules Set viewport or emulation before navigation, then check the applicable media conditions.
CSS appears to load but a particular element is wrong DOM state, selector matching, or cascade Inspect the element, its classes, computed styles, and any overriding rule.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot without configuring Puppeteer, ScreenshotNeo is a website screenshot API and MCP server. Its clean-shot steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

One GET request returns an image or PDF. The API uses parameter names other screenshot APIs use, which can make switching easier. See the ScreenshotNeo documentation for the available parameters and options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo’s free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Frequently Asked Questions

Does Puppeteer remove CSS when it takes a screenshot?

No. A screenshot reflects the browser’s rendered page; investigate missing or unapplied resources and page state before blaming the screenshot call.

Does `networkidle2` guarantee that a page is fully styled?

No. It is a navigation wait condition, not proof that required assets succeeded or that the application reached the state you need.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I capture an element even if it is out of view?

Puppeteer’s Screenshots guide says `ElementHandle.screenshot()` tries to scroll the element into view if it is hidden.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.