Viewport Configuration
Viewport configuration is setting the viewport meta tag so a page scales to the device's screen width, the foundation of responsive, mobile-friendly design.
What is Viewport Configuration?
Viewport configuration is the practice of setting a page’s viewport meta tag so that mobile browsers display it at the width of the device screen. The standard setting, width=device-width, initial-scale=1, makes responsive layouts work and keeps text readable without zooming. It is a basic requirement for mobile-friendly pages and for performing well under mobile-first indexing.
When smartphones first appeared, most sites were built for desktops. Mobile browsers therefore rendered pages on a virtual canvas about 980 pixels wide and shrank it to fit, which made text tiny. The viewport meta tag, introduced by Apple’s Safari and adopted by other browsers, lets developers opt out of that behavior.
How it works
Add this to the <head> of every page:
<meta name="viewport" content="width=device-width, initial-scale=1">
| Property | What it does |
|---|---|
width=device-width | Matches the layout width to the device’s screen width |
initial-scale=1 | Starts the page at 100% zoom |
maximum-scale, user-scalable | Restrict zoom; avoid for accessibility |
viewport-fit=cover | Extends layout into display cutouts on some phones |
The tag works together with responsive CSS: fluid grids, flexible images and media queries that adjust layout at different widths.
Examples
- A B2B SaaS landing page built by an agency lacks a viewport tag. On phones it appears as a shrunken desktop page, and paid social traffic converts poorly. Adding the tag, plus fixing a few fixed-width containers, makes the page usable on mobile.
- A docs site sets
maximum-scale=1to stop iOS zooming on form fields. The better fix is setting input font sizes to at least 16px, which prevents the automatic zoom while keeping pinch-to-zoom available.
Best practices
- Use the standard tag on every template, including landing pages built outside the main CMS.
- Avoid fixed widths in CSS that exceed small screens.
- Size images responsively with
max-width: 100%andsrcset. - Test on real devices and with Chrome DevTools device emulation.
- Keep zoom enabled.
How to check your viewport
View the page source and search for name="viewport", or run Lighthouse in Chrome DevTools, which flags a missing or misconfigured viewport tag. Then load the page in device emulation at several widths (for example 360, 390 and 768 pixels) and look for horizontal scrolling, clipped elements or text that needs zooming. Repeat for every template, including landing pages and docs.
Common mistakes
- Setting
width=1024or another fixed value. - Including multiple conflicting viewport tags from different plugins.
- Assuming the tag alone makes a site responsive; CSS must also adapt.
- Disabling zoom to hide layout problems.
Related terms
- Mobile-First Indexing
- SEO Responsive Design
- Mobile Usability
- Touchscreen Usability
- Adaptive Design
- Mobile Metadata
Sources
- Viewport meta tag (MDN Web Docs)
- Responsive web design basics (web.dev)
- Mobile-first indexing best practices (Google Search Central)
Frequently asked questions
What is the correct viewport meta tag?
For almost all sites, a meta tag named viewport with the content "width=device-width, initial-scale=1". It tells the browser to match the page width to the device width and start at normal zoom. Responsive CSS media queries then adapt the layout to different screen sizes.
Why is the viewport tag important for SEO?
Google uses mobile-first indexing, meaning it primarily crawls and evaluates the mobile version of pages. A missing or broken viewport makes pages hard to use on phones, which hurts users and the mobile experience Google assesses. Lighthouse flags a missing viewport tag.
Should I set user-scalable=no?
No. Preventing zoom makes text and controls hard to use for people with low vision and fails accessibility expectations. Modern mobile browsers handle double-tap and zoom well when the layout is responsive, so there is no need to restrict it.