Black Friday: is your store ready?Free check + 7 days of Pro free →

Mobile layout: viewport tag and horizontal scrolling

Last updated:

Most online stores now get a large share of their traffic from phones, and peak sales like Black Friday make the share even bigger. Two layout bugs ruin that visit before the shopper sees a single product: a page without a viewport meta tag, which phones render at desktop width, and a page whose content is wider than the screen, which forces sideways scrolling. Both are quick to fix.

Bug 1: the missing viewport tag

Without a viewport tag, a mobile browser lays the page out on a wide virtual canvas, then shrinks it to fit the screen. Text becomes tiny, buttons too small to tap, and the shopper has to pinch-zoom to read a price. Add this to the <head> of every page:

<meta name="viewport" content="width=device-width, initial-scale=1">

Two rules:

  • Put it in the base layout or theme, not page by page, so landing pages and checkout steps get it too. Custom landing pages built outside the theme are where it most often goes missing.
  • Don't block zooming. Avoid maximum-scale=1 and user-scalable=no: people with low vision need to zoom, and accessibility guidelines ask for it.

Bug 2: content wider than the screen

When something on the page is wider than the viewport, the whole page can be dragged sideways. Headers shift, the layout wobbles, and on product pages the add-to-cart button can end up half off-screen. The usual culprits:

  • Images without max-width: 100%, often in product descriptions pasted from a supplier.
  • Tables, such as size guides and spec sheets.
  • Embeds: videos, maps, reviews or social widgets with a fixed width.
  • Long unbroken strings: URLs, SKUs, coupon codes.
  • Fixed-width containers or negative margins from an old desktop-only theme.

How to find the culprit

  1. Open the page in your browser's developer tools and switch on the device toolbar with a phone width such as 390px.
  2. Scroll sideways: if the page moves, something overflows.
  3. In the console, list the elements wider than the screen:
[...document.querySelectorAll('*')].filter(el => el.getBoundingClientRect().right > document.documentElement.clientWidth)

The last, most specific element in the list is usually the one to fix.

The CSS that fixes it

img, video, iframe { max-width: 100%; height: auto; }
.table-wrapper { overflow-x: auto; }      /* wrap wide tables in this */
.product-description { overflow-wrap: anywhere; }  /* long URLs and codes */

Wrap wide tables in a scrollable container instead of squeezing them, so the table scrolls but the page doesn't. Replace fixed pixel widths on containers with max-width and flexible layouts.

Avoid hiding the problem with overflow-x: hidden on the body: it can cut off content and break sticky headers, and the element that overflows is still too wide.

Check it before peak season

Test your home page, a category page, a product page with a long description, the cart and each checkout step on a real phone. A fast page matters too: see Core Web Vitals for e-commerce, and the Black Friday checklist for the rest of your preparation.

How Averifly helps

Averifly's technical rules flag pages with no viewport meta tag, and pages whose content overflows a 390px-wide mobile screen, so you know exactly which URLs to open. Run a free scan, and see our rules for the full list of checks.

Frequently asked questions

What viewport meta tag should an online store use?

Use <meta name="viewport" content="width=device-width, initial-scale=1"> in the head of every page. It tells mobile browsers to use the device's width instead of a desktop-width canvas. Don't disable zooming with maximum-scale=1 or user-scalable=no, which hurts accessibility.

Why does my store scroll sideways on a phone?

Usually one element is wider than the screen: an image without max-width, a wide table, an embedded video or iframe with a fixed width, a long unbroken string such as a URL, or a container with a fixed pixel width. Find it with the browser's device toolbar and constrain it with responsive CSS.

Does mobile layout affect SEO?

Google indexes sites primarily from their mobile version, so content that is hard to use on a phone is also what search engines evaluate. Above all, a broken mobile layout loses the shoppers who arrive on phones.

More Technical guides