carloscape/octorato/horizontal-scroll-html-vs-body
Claude Code and agent skill by carloscape/octorato
- community
Checking that the SKILL.md file is still in the repository.
Android Chrome ignores overflow-x:hidden on <body> if <html> still allows it — clip the root, not just the body, to kill phantom horizontal scroll
Install
npx vskill@latest install carloscape/octorato/horizontal-scroll-html-vs-bodySKILL.md
Horizontal Scroll — html vs body
What
A page renders cleanly on desktop and iOS Safari but on Android Chrome the user can drag the page left/right ("phantom horizontal scroll") even though nothing visible extends past the viewport. The most common reason is that overflow-x: hidden was placed on <body> but not on the <html> root.
Why this is browser-specific
When a descendant element briefly exceeds viewport width — an absolutely positioned dropdown with a fixed w-XX value, an off-screen carousel slide, an image without max-width: 100%, a transformed element, an inset-x-… container — the overflow propagates up to the initial containing block, which is the <html> element, not <body>.
| Browser | Honors body { overflow-x: hidden } alone | Result | |
|---|---|---|---|
| Chrome desktop | Yes | No phantom scroll | |
| Firefox / Edge desktop | Yes | No phantom scroll | |
| Safari iOS | Yes (usually) | No phantom scroll | |
| Chrome Android | No | html scrolls horizontally |
This bites mobile-heavy sites first because dev usually QAs on desktop.
When to suspect this
- "Site moves left/right when I swipe but I don't see anything wider"
- Only on Android, not iPhone, not desktop
- Affects ALL pages of a layout, not just one (points at root layout, not page-specific)
- Browser devtools "outline every element" trick reveals no visibly overflowing element
Fix
One line: add overflow-x: hidden to the <html> element. With Tailwind in an Astro/Next.js/Svelte layout that's literally:
In plain CSS:
Diagnostic
- Open the page in Android Chrome devtools (
chrome://inspectfrom desktop). - In Elements → Computed, select the
<html>element. Look foroverflow-x. - If it's
visible(the default) and<body>hashidden, you have this bug. - Inject
document.documentElement.style.overflowX = 'hidden'in the console —
the scroll disappears? Confirmed.
Anti-patterns
- Adding
overflow: hidden(without the-x) — kills vertical scroll too. The
page becomes a fixed-height card.
- Adding
width: 100vwto body — on iOS Safari,100vwincludes the scrollbar
area on some configs, so the body itself becomes wider than the viewport. Stick to overflow-x: hidden on both html and body.
- Trying to track down "what's overflowing" before applying the root-level
clip. The clip is cheap and the failure mode (silently hiding off-canvas content) is rare in practice for well-built layouts.
Lessons Learned
<!-- Date · Symptom · Element that was overflowing (post-mortem grep) · Fix applied -->
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/horizontal-scroll-html-vs-body/SKILL.md
Popularity
- Repository stars
- 17
- Repository forks
- 7
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/carloscape/octorato/horizontal-scroll-html-vs-body)