Responsive & Mobile Tools and Commands: Ready to Reuse

Mobile checks don't need complicated platforms. Use browser DevTools for layout, Lighthouse for performance, Playwright for multi-viewport tests, a few lines of…

Insights:Responsive & Mobile Tools and Commands: Ready to Reuse

1. DevTools Device Mode

  • Open Developer Tools.
  • Toggle the device toolbar.
  • Select 320, 375, 414, 768, and 1024 in sequence.
  • Check horizontal scrolling, tap targets, fonts, and images.
  • Enable network throttling to simulate a slow connection.

2. Lighthouse

Mobile mode (default):

npx lighthouse https://example.com/ --output html --output-path ./lh-mobile.html

Desktop mode:

npx lighthouse https://example.com/ --preset=desktop --output html --output-path ./lh-desktop.html

Focus on:

  • LCP, INP, CLS.
  • Image sizes.
  • Unused JS/CSS.
  • Font loading.

3. Playwright Multi-Viewport

npx playwright install chromium
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const widths = [320, 375, 414, 768, 1024, 1440]
for (const width of widths) {
    const page = await browser.newPage({ viewport: { width, height: 900 } });
    await page.goto('https://example.com/', { waitUntil: 'networkidle' });
    const overflow = await page.evaluate(() => document.documentElement.scrollWidth > window.innerWidth);
    console.log(width, 'horizontal_overflow=', overflow);
    await page.screenshot({ path: `shot-${width}.png`, fullPage: true });
    await page.close();
  }
  await browser.close();
})();

IV. Check for Overflow in Browser Console

[...document.querySelectorAll('*')]
  .filter(el => el.scrollWidth > document.documentElement.clientWidth)
  .slice(0, 20)
  .forEach(el => console.log(el.tagName, el.className, el.scrollWidth));

Finding specific elements is faster than blindly modifying CSS.

V. Response Headers and Caching

curl -I https://example.com/
curl -I https://example.com/assets/app.css

Check:

  • content-type
  • cache-control
  • content-encoding
  • server-timing

VI. Image Check

curl -I https://example.com/hero.jpg

Verify:

  • Actual dimensions.
  • Whether it is in WebP/AVIF format.
  • Cache headers.
  • Whether it returns different sizes on demand (CDN).

VII. CSS Breakpoint Check

/* Mobile-first, switch by content */
@media (min-width: 640px) { /* Tablet */ }
@media (min-width: 1024px) { /* Desktop */ }

Don't write a separate set for each device model.

VIII. Test Matrix

Width Focus
320 Minimum screen, overflow
375 Mainstream phones
414 Large-screen phones
768 Portrait tablets
1024 Landscape tablets / small laptops
1440 Desktop

9. Recording Results

Save:

  • Lighthouse report.
  • Screenshots at each width.
  • List of overflowing elements.
  • Before-and-after comparison.

Scope & Limitations

Tools can surface issues, but they can't make design decisions for you. Adjust commands according to your project's tech stack; Node tools require a local environment.

Related reading: