Fixing the Lighthouse “Content is not sized correctly for the viewport” Warning
If Lighthouse shows "Content is not sized correctly for the viewport" (in the Japanese-language report, the message is shown as a translated Japanese sentence), the page either has an element that extends past the right edge of a phone-width screen, or it has no meta viewport tag, so the page is rendered wider than the screen. This warning appears when the page is wider than the screen at the same phone width that Lighthouse uses, so you can scroll sideways. To fix it, find the element that overflows, then change the CSS so it fits within the screen width.
In my test environment, I made a page with a table fixed at 640px wide and a long non-wrapping command. In Lighthouse 11.7.1, the page was 656px wide against a 412px screen, which failed the audit. After I set the table width to 100% and added overflow-x: auto to the command box, the page width became 412px and the warning went away.
This audit is in the PWA category. Lighthouse 12.0.0 removed the PWA category entirely, so this warning appears only in Lighthouse 11 and earlier.
The test environment was Ubuntu 24.04 with Node.js 22.23.5. I installed Lighthouse 11.7.1, the last version with this audit, along with 12.8.2 and the latest 13.6.0 from npm, and ran them from the CLI. The browser was Google Chrome for Testing 158, specified with CHROME_PATH, running in headless mode. Unless noted otherwise, the results are from running only the PWA category of 11.7.1 with the default mobile settings (412px screen width). I built the pages in the test environment and served them from 127.0.0.1 with a small server written in Node.js. I checked the wording of the Japanese report against Lighthouse's translation files. I did not test the Lighthouse panel in Chrome DevTools, PageSpeed Insights, or display on a real phone.
- 1. Testing with a page whose table and command were wider than the screen
- 2. What the two numbers in the explanation mean
- 3. Finding the overflowing element with Playwright
- 4. Setting the table to 100% and letting the command scroll inside its box
- 5. One remaining overflow still fails
- 6. Adding overflow-x: hidden to body does not clear it
- 7. Pages without a meta viewport and the desktop preset
- 8. Reports from Lighthouse 12 and later do not include it
Testing with a page whose table and command were wider than the screen
For the test, I made a page that logs how much cat food was given. The <head> includes <meta name="viewport" content="width=device-width, initial-scale=1">. The table is set to 640px wide, and the <pre> containing the command has no width set.
body { margin: 0; padding: 16px; font-family: sans-serif; line-height: 1.6; }
.log { width: 640px; border-collapse: collapse; }
.log th, .log td { border: 1px solid #9aa5ab; padding: 4px 8px; }
.code { background: #eefafd; padding: 8px; }
<pre class="code">feed --morning 30 --night 30 --cat tama --note "完食" --weight 4.2 --date 2026-11-21</pre>
I served the page from 127.0.0.1:8000 and ran Lighthouse 11.7.1 like this:
npx lighthouse http://127.0.0.1:8000/bad.html --only-categories=pwa \
--output=json --output=html --output-path=./out/bad \
--chrome-flags="--headless=new --no-sandbox" --quiet
For the test, I set the environment variable CHROME_PATH to the path of the Chrome for Testing executable before running it. I added --no-sandbox only to start Chrome in the test environment.
When I ran it, the warning appeared under "PWA Optimized" in the PWA section. (In the Japanese-language report, this label is shown in translated Japanese.)

I used a small script I wrote to pull the score and the content-width result from the JSON report:
pwa score: 25 failed: installable-manifest, splash-screen, themed-omnibox, content-width, maskable-icon
[content-width] weight=1 group=pwa-optimized score=0 (binary) title: Content is not sized correctly for the viewport explanation: The viewport size of 656px does not match the window size of 412px.
The PWA score is low because this page has no manifest and similar files. This article looks only at content-width.
What the two numbers in the explanation mean
The explanation, "The viewport size of 656px does not match the window size of 412px.", shows the viewport size (656 px) and the window size (412 px). (In the Japanese-language report, this sentence is shown in translated Japanese.)
Lighthouse reads window.innerWidth and window.outerWidth from the page using viewport-dimensions.js. In the audit source (content-width.js), the audit passes if these two values are equal and fails if they differ. The official explanation also says the audit fails when window.innerWidth is not equal to window.outerWidth.
412px is the width of the phone screen that Lighthouse emulates. 656px was the farthest right point that the page's content reached. The table's left edge sits at the 16px padding of body, so the right edge of the 640px table is 16 + 640 = 656px. In this test, the right edge of the element that extended farthest past the screen appeared as the first number in the explanation (the viewport size).
Finding the overflowing element with Playwright
The report does not show which element overflows. So I wrote a script that opens the page in Playwright under the same screen conditions Lighthouse uses (412px width, mobile) and lists every element that extends past the screen width.
// find-wide.cjs
const { chromium } = require('playwright');
(async () => {
const b = await chromium.launch({ channel: 'chromium' });
const ctx = await b.newContext({ viewport: { width: 412, height: 823 }, deviceScaleFactor: 1.75, isMobile: true, hasTouch: true });
const p = await ctx.newPage();
for (const name of process.argv.slice(2)) {
await p.goto('http://127.0.0.1:8000/' + name);
const r = await p.evaluate(() => {
const cw = document.documentElement.clientWidth;
const wide = [...document.body.querySelectorAll('*')]
.map(el => {
const right = Math.round(el.getBoundingClientRect().right);
const parentRight = el.parentElement.getBoundingClientRect().right;
const contentRight = Math.round(el.getBoundingClientRect().left + el.scrollWidth);
const name = `${el.tagName.toLowerCase()}${el.className ? '.' + el.className : ''}`;
if (right > cw && parentRight <= cw) return `${name} box right=${right}`;
if (right <= cw && contentRight > cw && getComputedStyle(el).overflowX === 'visible') return `${name} content right=${contentRight} (box right=${right})`;
return null;
})
.filter(Boolean);
return { innerWidth: innerWidth, outerWidth: outerWidth, clientWidth: cw, scrollWidth: document.documentElement.scrollWidth, wide };
});
console.log(`== ${name} innerWidth=${r.innerWidth} outerWidth=${r.outerWidth} clientWidth=${r.clientWidth} scrollWidth=${r.scrollWidth}`);
for (const w of r.wide) console.log(' ' + w);
if (!r.wide.length) console.log(' (no element wider than clientWidth)');
}
await b.close();
})();
The script catches two kinds of overflow. The first is when the element's own box extends past the right edge of the screen (box right). It lists only the outermost such elements, where the parent box does not overflow. The second is when the box fits on screen but its text extends outside the box (content right). I served the page from 127.0.0.1:8000 as before. Here is the result for the page before the fix:
node find-wide.cjs bad.html
== bad.html innerWidth=656 outerWidth=412 clientWidth=412 scrollWidth=656
table.log box right=656
pre.code content right=570 (box right=396)
The table's box extended to 656px. The <pre> box ended at 396px and fit on screen, but the text of the non-wrapping command extended to 570px. innerWidth was 656, the same as in the Lighthouse explanation.
I passed channel: 'chromium' to chromium.launch() so the page opens in the same Chrome build I gave Lighthouse. According to the Playwright documentation, when running headless, Playwright uses a separate "chromium headless shell" by default instead of regular Chromium. When I left the option out, the monospace characters in the <pre> were a different width on the same page, and the results did not match Lighthouse.
Setting the table to 100% and letting the command scroll inside its box
I changed the table width from a fixed 640px to 100%. Wrapping the command makes it hard to read, so I added overflow-x: auto to the <pre> and let only the box scroll sideways.
.log { width: 100%; border-collapse: collapse; }
.code { background: #eefafd; padding: 8px; overflow-x: auto; }
After the fix, content-width passed, and the Playwright script found no overflowing elements.
[content-width] weight=1 group=pwa-optimized score=1 (binary) title: Content is sized correctly for the viewport
== fixed.html innerWidth=412 outerWidth=412 clientWidth=412 scrollWidth=412
(no element wider than clientWidth)
Below are screenshots of the same page at the same width (412px). Before the fix, the "memo" column of the table was off-screen. After the fix, the table fits within the screen width.

Besides tables and commands, images can also overflow the same way when they are displayed wider than the screen. The web.dev article on responsive web design basics explains that wide images can cause horizontal scrolling, and recommends setting max-width: 100% on all images.
One remaining overflow still fails
I also tested a page where only the table was fixed and the <pre> did not have overflow-x: auto. It failed, and the first number in the explanation was 570px, the right edge of the command text.
[content-width] weight=1 group=pwa-optimized score=0 (binary) title: Content is not sized correctly for the viewport explanation: The viewport size of 570px does not match the window size of 412px.
On the page before the fix, the command's overflow was hidden behind the table's 656px, so it did not show up in the explanation. If you fix one spot and the audit still fails with only the number changed, another element is still overflowing.
Adding overflow-x: hidden to body does not clear it
I also tested the page before the fix with overflow-x: hidden added to body, which would hide the overflow.
body { overflow-x: hidden; }
The result was the same as before the change: it still failed. In the Playwright script, innerWidth remained 656.
[content-width] weight=1 group=pwa-optimized score=0 (binary) title: Content is not sized correctly for the viewport explanation: The viewport size of 656px does not match the window size of 412px.
== hidden.html innerWidth=656 outerWidth=412 clientWidth=412 scrollWidth=656
table.log box right=656
pre.code content right=570 (box right=396)
The warning went away only after I fixed the width of the overflowing elements themselves.
Pages without a meta viewport and the desktop preset
I removed <meta name="viewport"> from the fixed page and ran the audit again. The content-width and viewport audits both failed. No element overflowed, but the page width was reported as 981px.
pwa score: 0 failed: installable-manifest, splash-screen, themed-omnibox, content-width, viewport, maskable-icon
[content-width] weight=1 group=pwa-optimized score=0 (binary) title: Content is not sized correctly for the viewport explanation: The viewport size of 981px does not match the window size of 412px.
[viewport] score=0 title: Does not have a `<meta name="viewport">` tag with `width` or `initial-scale`
When I opened the page in the Playwright script, clientWidth was 980, and the page itself was rendered wider than the screen. In this case, add <meta name="viewport" content="width=device-width, initial-scale=1"> to the <head> before changing any CSS.
With the desktop preset (--preset=desktop), content-width was marked notApplicable, even on the page before the fix. This warning only appears when you test with mobile settings.
Reports from Lighthouse 12 and later do not include it
I ran Lighthouse 12.8.2 and 13.6.0 on the same page before the fix. Neither report included a content-width audit.
== bad12.report.json (Lighthouse 12.8.2, HeadlessChrome/158.0.0.0, formFactor mobile)
content-width: (no such audit in this report) audits containing "width": (none)
== bad13.report.json (Lighthouse 13.6.0, HeadlessChrome/158.0.0.0, formFactor mobile)
content-width: (no such audit in this report) audits containing "width": (none)
When I looked inside each version's npm package, the content-width audit file was in 11.7.1 and missing from 12.0.0. The 12.0.0 section of the Lighthouse changelog says the PWA category was removed. The official explanation also says that testing PWAs with Lighthouse is deprecated.
A high score in Lighthouse 12 or later does not guarantee that the page fits the screen width. The 640px table page also got no width warning in 12.8.2 or 13.6.0. To check for yourself, compare innerWidth and outerWidth using the Playwright script above, or install Lighthouse 11 with npm i -D lighthouse@11.7.1 and run it.





