UICheck

BasicsUpdated 12 October 20264 min read

The viewport meta tag: why your site looks zoomed out on phones

Without a viewport meta tag, phones assume your page was built for a desktop about 980px wide and shrink it to fit the screen. Text becomes tiny, your media queries never fire, and visitors have to pinch to read anything. One line in the <head> fixes it.

What it looks like

The same page on an iPhone 17 (402px wide), with the problem and then the fix.

Before
Before: Without the viewport tag the phone lays the page out about 980px wide and shrinks it: the text is unreadable.
Without the viewport tag the phone lays the page out about 980px wide and shrinks it: the text is unreadable.
After
After: With the tag the page is laid out at the phone’s own width.
With the tag the page is laid out at the phone’s own width.

Why phones shrink a page without it

Phones have two viewports. The layout viewport is the width the browser lays the page out at; the visual viewport is the part you can see. Without the tag, mobile browsers assume the page was made for desktops and use a layout viewport of about 980px, then zoom out until it fits a 360–430px screen. The page is laid out for a desktop, so your phone styles never apply.

width=device-width sets the layout viewport to the phone’s own width in CSS pixels (for example 402px on an iPhone 17), so a min-width: 768px query is false on a phone and your mobile layout is used.

The correct tag

Put this inside <head> on every page:

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

What each setting in the tag does

  • width=device-width: lay the page out at the device’s width. This is the part that matters most.
  • initial-scale=1: open at 100% zoom. It also keeps the scale steady when a phone is turned sideways.
  • maximum-scale and minimum-scale: limit how far people can zoom. Leave them out; maximum-scale=1 blocks zoom.
  • user-scalable=no: blocks zoom completely. Never use it: it fails WCAG 1.4.4 (resize text), and Safari on iPhone ignores it anyway.
  • viewport-fit=cover: lets the page fill the screen around the notch and rounded corners on iPhones. Only add it if you also pad content with env(safe-area-inset-*).
  • interactive-widget=resizes-content: in Chrome on Android, makes the page shrink when the on-screen keyboard opens, so fixed bars and forms stay in view.

Mistakes to avoid

  • user-scalable=no or maximum-scale=1: stops people zooming, which fails accessibility guidelines (WCAG 1.4.4). Leave zoom on.
  • A fixed width such as width=1024: phones render a 1024px page and shrink it, the same as having no tag.
  • Adding the tag in JavaScript after load: the page first renders zoomed out, then jumps.
  • Missing on some templates: blog posts, landing pages or checkout steps built from a different template often lack it.
Watch out

Don’t add user-scalable=no or maximum-scale=1 to stop iPhones zooming into form fields. Give the fields a font size of 16px instead; that stops the zoom without blocking it for everyone.

Full-screen sections and the address bar

On phones, 100vh is the height with the browser’s address bar hidden, so a full-screen hero is taller than the visible screen and its button sits under the bar. Use the newer viewport units instead: 100svh (small: the bar shown), 100lvh (large: the bar hidden) or 100dvh (dynamic: follows the bar).

.hero { min-height: 100vh; min-height: 100svh; } /* the second line wins where it is supported */ /* Fill the screen around the iPhone notch (with viewport-fit=cover) */.page { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

Frameworks, themes and page builders

Most frameworks and themes add the tag for you: Next.js adds a default one, and WordPress and Shopify themes print it in their header template. Problems come from older themes, hand-made landing pages, email-style templates and pages that override the default. Always check the rendered HTML in the browser (View source), not only the template, and only one viewport tag should be on the page.

After adding it, check the layout

Once phones render at their real width, any element with a fixed desktop width will now stick out and make the page scroll sideways. That is not the tag’s fault; those elements were always too wide. Fix them with max-width: 100% and flexible layouts.

How to test

View the page source and search for name="viewport", then open the page on a real phone or in device mode at 360px. Text should be readable without zooming and nothing should scroll sideways.

Checklist

Questions

What happens without a viewport meta tag?

Phones render the page at about 980px wide and shrink it to the screen, so text is tiny and mobile styles never apply.

Should I use user-scalable=no?

No. Blocking zoom makes the page hard to read for many people and fails accessibility guidelines.

Does the viewport tag affect SEO?

Yes. Google indexes the mobile version of pages, and a page without it is not mobile friendly.

What does initial-scale=1 mean?

It opens the page at 100% zoom, so one CSS pixel matches one device-independent pixel, and keeps the scale steady when the phone is rotated.

Do I still need a viewport meta tag in 2026?

Yes. Mobile browsers still lay out pages without it at about 980px wide and shrink them to fit, so every responsive site needs it.

Can I have two viewport meta tags?

No. Use one; when there are several, browsers use one of them and the result depends on order, which makes bugs hard to find.

Find these bugs before your client does

Free account, 5 checks a day, no card. UICheck finds sideways scroll, cut-off text, overlaps and small tap targets on every screen.