October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Capture a Mobile Web Page Screenshot at an Exact CSS Viewport

Set a mobile page’s CSS viewport explicitly, choose CSS- or device-pixel output, and capture only the visible area with Playwright, DevTools, or Puppeteer.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Set the browser’s viewport width and height explicitly in CSS pixels before loading the page, then capture the visible viewport rather than the full page. For automated captures, Playwright offers direct control over viewport size and whether output pixels map to CSS pixels or device pixels. Use mobile emulation as well when the page needs mobile-specific behavior such as touch input or a mobile user agent.

What “exact CSS viewport” means

A CSS viewport is the width and height, in CSS pixels, that the browser uses as the page’s visible layout area. It is not necessarily the screenshot’s pixel dimensions. Device pixel ratio (DPR) relates physical screen pixels to CSS pixels, while the screenshot scale determines how those dimensions map into the image.

As an Amazon Associate I earn from qualifying purchases.

  • With a 390 × 844 CSS viewport and Playwright’s scale: 'css', the image is one pixel per CSS pixel: 390 × 844 image pixels.
  • With scale: 'device', the image uses device pixels. At a DPR greater than 1, its pixel dimensions can be larger than the CSS viewport dimensions.

Choose the viewport to control responsive layout. Choose screenshot scale and device scale factor to control output pixels. If you need mobile browser characteristics—not just a narrow layout—also configure mobile emulation deliberately.

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.

Capture an exact viewport with Playwright

Create a browser context with explicit dimensions before opening the page. The example uses a 390 × 844 CSS viewport, enables mobile emulation, and requests one screenshot pixel per CSS pixel.

#1 Best Overall
Sale
Motorola Moto g - 2026 | Unlocked | Made for US 4/128GB | 50MP Camera | Pantone Slipstream, Cellular_Phone
  • Universal unlocked. Compatible with all major U.S. carriers, including Verizon, AT&T, T-Mobile and other prepaid carriers.
  • Super-bright, super-smooth 6.7" display. See your screen clearly even outdoors in sunlight, and enjoy seamless views with a fast-refreshing 120Hz display.*
  • AI-powered camera system. Take stunning photos in any light with the 50MP camera**, look your best with a 32MP selfie cam*****, and capture extreme close-ups.
  • Superfast 5G performance. Unleash your entertainment at 5G speed*** with the MediaTek Dimensity 6300 chipset and up to 12GB of RAM with RAM Boost****.
  • Long-lasting battery + TurboPower charging. Power through day after day with a 5200mAh battery, then get hours of power in just minutes.****
const context = await browser.newContext({
  viewport: { width: 390, height: 844 },
  isMobile: true,
  deviceScaleFactor: 1,
});
const page = await context.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'mobile-390x844.png', scale: 'css' });

Replace the example URL with the page you want to capture. The browser object must already be launched in your Playwright setup. Set the context viewport before navigation so the page loads at the intended size.

Choose the right emulation settings

If you are checking only responsive CSS at a particular width and height, the explicit viewport may be all you need. If behavior depends on mobile browser characteristics, set mobile emulation properties too. Playwright device presets can simulate properties such as user agent, screen size, viewport, and touch support; you can override a preset’s viewport by setting your custom viewport afterward. See the Playwright emulation documentation.

Rank #2
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

Keep deviceScaleFactor and screenshot scale distinct. The former sets the emulated device’s pixel ratio; the latter controls screenshot output scaling. Use scale: 'css' for one output pixel per CSS pixel, or scale: 'device' when device-pixel output is required. The Playwright Page API documents the screenshot options.

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

Viewport capture versus full-page capture

The default Playwright screenshot is a viewport capture. It records the configured visible area. Add fullPage: true only when you want the full scrollable page; that output is not a fixed-height viewport screenshot.

Rank #3
Sale
Samsung Galaxy A16 5G 128GB Cell Phone, Unlocked Android Smartphone, Large AMOLED Display, Durable Design, Super Fast Charging, Expandable Storage, US Version, 2025, Blue Black (Renewed)
  • Charger NOT Included, 6.7" Super AMOLED FHD+, 90Hz Refresh Rate, 385 ppi, 800 nits (HBM), 1080x2340px, 5000mAh Battery
  • 128GB, 4GB RAM, microSDXC, Exynos 1330 (5nm), Octa-Core, Mali-G68 MP2 or Mali-G57 MC2 GPU
  • Rear Camera: 50MP, f/1.8 (wide) + 5MP, f/2.2 (ultrawide) + 2MP, f/2.4 (macro), LED flash, panorama, HDR; Front Camera: 13MP, f/2.0, Android 14, up to 6 major Android upgrades, One UI 6.1
  • 3G: HSDPA 850/900/1700(AWS)/1900/2100; 4G LTE: 1/2/3/4/5/7/12/13/14/20/25/26/28/29/30/38/39/40/41/48/66/71, 5G: 2/5/25/41/66/71/77/78 SA/NSA/Sub6/mmWave - Nano-SIM + eSIM
  • US Model – Global Connectivity – Compatible with Most GSM Carriers like T-Mobile, AT&T, MetroPCS, etc. Will Also work with CDMA Carriers Such as Verizon, Straight Talk.

Capture manually in Chrome DevTools

  1. Open Chrome DevTools and turn on Device Mode.
  2. Choose Responsive Viewport Mode, then enter the required width and height in the viewport fields.
  3. If mobile characteristics matter, select the intended device type and set the device pixel ratio as needed.
  4. Choose Capture screenshot for the visible viewport, or Capture a full size screenshot for the entire page.

DevTools also allows custom device definitions with a name and dimensions. Device pixel ratio, user agent, and device type are optional fields for a custom device. For details on sizing, device simulation, and capture commands, see Chrome DevTools Device Mode.

Use Puppeteer with a mobile device preset

Puppeteer’s page.emulate(device) applies device metrics and user agent. Apply it before navigating: resizing after a page has loaded can affect sites that do not expect a phone-sized viewport change.

Rank #4
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
await page.emulate(puppeteer.KnownDevices['iPhone 13']);
await page.goto('https://example.com');
await page.screenshot({ path: 'mobile.png' });

For an exact custom CSS viewport rather than a named preset, configure the viewport directly and set any other emulation settings the page requires. The device preset’s viewport may need to be overridden if its dimensions do not match your target. Puppeteer describes page.emulate() in its Page.emulate() documentation.

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

Choose a capture method

Approach Best for Key control
Playwright Repeatable automated captures or tests Explicit context viewport and screenshot scale
Chrome DevTools Device Mode Quick manual capture and visual inspection Enter width and height; choose device type and DPR if needed
Puppeteer Scripted Chrome automation using device presets Emulate before navigation and keep metrics consistent

Use a custom viewport when the target is a precise CSS layout size. Choose a device profile when the page’s behavior depends on mobile emulation. For repeatable comparisons, keep the browser, viewport width and height, device scale factor, emulation options, page state, and capture mode consistent.

Best Value
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to | Prepaid Smartphone- 6.6" 120Hz Display, 5G , 50MP Quad Pixel Camera, Long-Lasting Battery
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting mismatched screenshots

  • The screenshot’s pixel dimensions exceed the viewport. The viewport is measured in CSS pixels, while the image may be using device pixels. Select scale: 'css' for Playwright output at one pixel per CSS pixel.
  • The page lays out like desktop despite a phone-sized capture. A custom width and height set the layout area, but may not reproduce all mobile browser behavior. Add the needed mobile emulation properties or use a device preset.
  • The page changes after resizing. Set viewport and emulation before navigation. Puppeteer specifically recommends applying emulation before navigating.
  • The screenshot is much taller than requested. Check that full-page capture is off. A full-page screenshot includes the scrollable page rather than just the fixed viewport.
  • Two captures at the same size differ. Confirm the same browser, width, height, device scale factor, emulation settings, page state, and capture mode are used. The viewport alone does not make the entire capture setup identical.

Or skip the browser setup

ScreenshotNeo can return a screenshot from one GET request. Its API accepts the familiar screenshot parameters other tools use, including viewport and device-related options. Consult the ScreenshotNeo API documentation for the supported parameters and defaults.

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

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month without a card.

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

Frequently Asked Questions

Does a 390 × 844 CSS viewport always produce a 390 × 844 image?

No. It does when using one image pixel per CSS pixel; device-pixel scaling can produce a larger image.

Should I use a device preset or a custom viewport?

Use a custom viewport for a precise layout size. Use a device preset or explicit mobile emulation when mobile browser characteristics are part of the behavior you need to capture.

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.