Responsive layout
responsive/no-fixed-wide-width
No layout box gets a fixed width wider than 320 CSS px; cap it with max-width or min(100%, …) so the page reflows on narrow screens.
seriousstaticWCAG 1.4.10 · AAfe-responsive
Why
A box with width: 960px or min-width: 500px stays that wide on a phone and at 400% zoom (a 1280px window zoomed four times is 320 CSS px), so every line has to be scrolled sideways to be read. Reflow (WCAG 1.4.10) asks that content fits 320 CSS px without two-dimensional scrolling, apart from things like data tables and maps.
Fix
Use max-width for the limit and let the box shrink: max-width: 60rem; margin-inline: auto, or width: min(100%, 40rem). Put a wide fixed size inside a @media (min-width: …) or @container query where there is room. Data tables and code blocks scroll inside their own wrapper.
Examples
/* bad */
.wrapper { width: 960px; }
/* good */
.wrapper { max-width: 60rem; margin-inline: auto; padding-inline: 1rem; }Sources
Facts
- Id
responsive/no-fixed-wide-width- Severity
- serious
- Check
- static checked in the source by
audit - Applies to
cssscsslesshtmlvuesvelteastro- WCAG 2.2
- 1.4.10, level AA
- Taught by the skill
fe-responsiveResponsive design- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain responsive/no-fixed-wide-width