October 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Hide Sticky Headers in a Playwright Full-Page Screenshot

Use Playwright’s screenshot-time CSS to hide a sticky header during full-page capture, with targeted selectors and guidance on layout, masking, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright’s screenshot-time style option to hide the matching header with CSS, and set fullPage: true to capture the full scrollable page. The stylesheet applies for the screenshot without changing your page code.

Hide the header with screenshot-time CSS

Pass a targeted CSS rule to page.screenshot(). Replace the example selector with one that matches the actual sticky header on your page:

await page.screenshot({
  path: 'page.png',
  fullPage: true,
  style: 'header { display: none !important; }',
});

fullPage: true requests a screenshot of the full scrollable page; it does not select or suppress the header. The style option injects CSS for the capture. Playwright’s current API documentation marks this option as added in v1.41, so check the documentation for your installed version and language binding if the option is unavailable: Page screenshot API and Screenshots guide.

As an Amazon Associate I earn from qualifying purchases.

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.

Use a specific selector when possible

A broad selector such as header may hide more than the sticky navigation. Prefer the page’s actual class or ID, and verify that it matches only the element you want removed:

const screenshotCss = `
  .site-header,
  #sticky-navigation {
    display: none !important;
  }
`;

await page.screenshot({
  path: 'page.png',
  fullPage: true,
  style: screenshotCss,
});

.site-header and #sticky-navigation are illustrative selectors, not universal Playwright or website names. Inspect the page and substitute selectors that exist in your target.

Choose whether the space should collapse

display: none removes the matched header from layout during rendering, so content below it may shift upward. If you want the header’s space to remain but its contents not to show, use a deliberate alternative such as visibility: hidden and check the resulting image. These approaches produce different layouts.

What to expect from full-page capture

Playwright describes a full-page screenshot as capturing the full scrollable page, as if the page were tall enough to fit it. The documentation does not guarantee one universal treatment of position: sticky across every browser and version. Apply explicit CSS to the unwanted header and inspect the output for the site and browser you use rather than relying on fullPage: true to remove or reposition it.

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

The screenshot stylesheet is documented to pierce Shadow DOM and apply to inner frames. This can help if the header is inside those contexts, but the selector still needs to match the element in the rendered page. Confirm the result in your target setup.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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

Hide, mask, or filter the header?

Approach Use it when Effect
Screenshot-time CSS with display: none The header should be absent and its layout space should collapse. Removes the matched element from layout for the capture.
Screenshot-time CSS with visibility: hidden The header should not be visible, but you want to retain its layout space. Hides the element while preserving its space; inspect the page-specific result.
mask You only need to cover the pixels occupied by the header. Places a colored overlay over the matched element’s bounding box; it does not remove the element from layout. The default mask color is pink, and the color can be configured. See the screenshot API.
stylePath in Playwright Test screenshot assertions You are using expect(page).toHaveScreenshot() and want a stylesheet for the comparison image. Applies stylesheet rules to filter dynamic or volatile elements. This is a visual-comparison option, distinct from the inline style option used by ordinary page.screenshot(). See Playwright Test screenshot assertions.

Keep animated headers from destabilizing captures

If the header animates or transitions, animations: 'disabled' can make the screenshot more stable. It does not hide the header. Playwright says finite animations are fast-forwarded to completion and fire transitionend; infinite animations are canceled to their initial state for the screenshot and played again afterward. Use it alongside the CSS rule only when animation affects the image. Details are in the screenshot API.

Troubleshoot a header that still appears

  • The selector matches nothing: replace the example selector with the actual element’s class, ID, or another reliable selector. A rule cannot hide an element it does not match.
  • A different header disappears: narrow a generic selector such as header to the specific navigation element.
  • The content jumps upward: that is the expected layout effect of display: none. Use a visibility-based rule if preserving the space is the intended result.
  • The header is covered but its space remains: that is how mask works; use CSS hiding if the layout space should collapse.
  • The screenshot option is rejected or ignored: check the installed Playwright version and language binding. The current API page identifies style as available from v1.41, and documentation under /docs/next may not match an older installation.
  • The result differs across pages or frames: inspect the actual capture. The stylesheet can reach Shadow DOM and inner frames, but the selector and page behavior still determine which element is affected.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP, or PDF; it is an alternative when you want a hosted capture rather than setting up a Playwright browser. See the ScreenshotNeo API documentation for its capture options.

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
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners like a visitor and removes 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 cost nothing, and each response reports the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

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

Sign up for 1,000 free screenshots a month, with no card required.

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.
Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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
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.

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
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.