{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-horizontal-scroll-81201bccccd9","title":"Prevent Horizontal Scrolling in Responsive Design","summary":"Ensure pages do not produce horizontal scrollbars at 320px viewport width and 400% zoom, complying with WCAG 2.1 Level AA standards. This includes checking for and fixing issues like fixed-width elements, unbreakable strings, and improper use of `width` and `overflow` properties.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-horizontal-scroll-81201bccccd9","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-horizontal-scroll-81201bccccd9","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-horizontal-scroll-81201bccccd9.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-horizontal-scroll-81201bccccd9\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before testing, ensure the browser zoom is reset to 100% and the viewport width is set to 320px. Use developer tools to simulate 400% zoom and check for horizontal scrollbars or content overflow.","instructions":"---\nname: horizontal-scroll\ndescription: \"Use when applies to all CSS layout rules. Check `width`, `min-width`, fixed pixel values on containers, `overflow`, `white-space`, and `word-break` properties. Use when auditing responsive design or WCAG 2.1 Level AA compliance. Test at 320px viewport width and at 400% browser zoom.\"\nmetadata:\n  category: css\n  priority: medium\n  difficulty: intermediate\n  estimatedTime: \"10\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/css\/horizontal-scroll\n---\n\n# Prevent horizontal scrolling\n\nLow-vision users who cannot read at standard zoom levels increase browser zoom to 200\u2013400%. At these zoom levels, a 1280px-wide page becomes effectively 320px wide. If elements overflow the viewport, users must scroll both vertically and horizontally to read content \u2014 this is exhausting and error-prone with a screen magnifier. WCAG 2.1 SC 1.4.10 (Reflow) specifically addresses this, requiring that all content is available without two-dimensional scrolling at 400% zoom.\n\n## Quick Reference\n\n- Pages must not produce horizontal scrollbars at viewport widths of 320px and above \u2014 WCAG 2.1 SC 1.4.10 (Reflow)\n- WCAG 2.1 SC 1.4.10 requires content to reflow at 400% zoom (equivalent to 320px CSS width) without horizontal scroll\n- Common causes: fixed-width elements wider than the viewport, `width: 100vw` not accounting for scrollbar width, long unbreakable strings, `white-space: nowrap`\n- Use `max-width: 100%` on images and media, `overflow-wrap: break-word` on text containers, and fluid layout units\n\n## Check\n\nTest the page at a 320px CSS viewport width (equivalent to 400% browser zoom on a 1280px screen). Look for horizontal scrollbars or content overflowing outside the viewport. Specifically check: (1) elements with fixed `width` values in px that exceed the viewport; (2) `min-width` values that prevent shrinking; (3) images or media without `max-width: 100%`; (4) `white-space: nowrap` on text that causes overflow; (5) `width: 100vw` on elements (scrollbar width causes overflow); (6) long URLs or unbreakable strings in content areas.\n\n## Fix\n\n(1) Replace fixed `width: Npx` on layout containers with `max-width: Npx` plus `width: 100%`. (2) Add `max-width: 100%` and `height: auto` to all images and media. (3) Apply `overflow-wrap: break-word` (with fallback `word-wrap: break-word`) to text containers that may contain long strings. (4) Replace `width: 100vw` with `width: 100%` on full-width elements (avoid scrollbar overflow). (5) Use CSS Grid or Flexbox with `flex-wrap: wrap` for multi-column layouts. (6) For data tables, wrap in a scrollable container: `overflow-x: auto` on the table wrapper, not the page body.\n\n## Explain\n\nWCAG 2.1 SC 1.4.10 (Reflow, Level AA) requires that content does not require two-dimensional scrolling when displayed at a width of 320 CSS pixels or a height of 256 CSS pixels. This corresponds to 400% zoom on a 1280\u00d71024 display. Exceptions are made for content that requires two-dimensional layout for usage (e.g., data tables, map interfaces, video). For all other content \u2014 body text, navigation, forms, images \u2014 horizontal scrolling is a barrier for screen magnification users who cannot see the full page width.\n\n## Code Review\n\nReview stylesheets, component styles, and responsive states related to Prevent horizontal scrolling. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/css\/horizontal-scroll\n","use_cases":["Auditing a website for WCAG 2.1 Level AA compliance","Fixing horizontal scrollbars in responsive layouts","Testing content reflow at 400% browser zoom"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/horizontal-scroll\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-23","created_at":"2026-11-22T16:22:51.000000Z","updated_at":"2026-11-23T04:55:09.000000Z","seo_title":"Prevent Horizontal Scroll in Responsive Design","seo_description":"Ensure your website does not produce horizontal scrollbars at 320px viewport width and 400% zoom. Follow best practices for WCAG 2.1 compliance.","seo_keywords":["prevent horizontal scroll","WCAG 2.1 compliance","responsive design audit","horizontal scrolling fix","reflow testing"]}}