Mobile browsers assume a page was designed for a desktop unless told otherwise. They lay it out at around 980 CSS pixels wide and scale it down, so text becomes tiny and buttons hard to tap. The viewport meta tag tells the browser to use the device's real width.
The tag to use
<meta name="viewport" content="width=device-width, initial-scale=1">The tag is only the start
Once the page uses the device width, the layout has to fit it. WCAG 2.2 success criterion 1.4.10, Reflow, asks that content can be used at 320 CSS pixels wide without scrolling in two directions. Common causes of sideways scrolling are fixed-width containers, wide tables, long unbroken strings such as URLs, and images without a maximum width.
img, video { max-width: 100%; height: auto; }
.table-wrap { overflow-x: auto; }
.long-text { overflow-wrap: anywhere; }How to check
- Open the page in your browser's device mode at 320 pixels wide.
- Scroll the page and look for anything that forces a horizontal scroll bar.
- Zoom the desktop browser to 400% and repeat; this is equivalent for most layouts.
- Run a Deep Audit, which checks for the viewport tag and for horizontal overflow at mobile width.
Glossary
- Viewport
- The visible area of a web page in the browser window or device screen.
- Reflow
- Content rearranging itself to fit a narrow width without loss of information or two-way scrolling.
Observed in published reviews
Zenith recorded this problem in these company website reviews.