How to Set the Viewport Meta Tag: Match the Device Width, Then Check the Layout

ProcrustesPR

For pages that need to adapt to different screens, a common starting point is to add <meta name=”viewport” content=”width=device-width, initial-scale=1″> to the HTML head section. This matches the viewport width to the device width and loads the page at a scale of 1. However, setting the viewport does not automatically make all content fit. If you still see horizontal scrolling, overly wide images, or hard-to-read text on mobile, check the CSS and layout against what appears on the screen.

ProcrustesPRProcrustesPRHow should I divide my DIY SEO budget?

Basic Settings: Width and Initial Scale

Semrush’s 2023 article recommends using width=device-width and initial-scale=1 when setting the tag manually, and placing it in the page’s head section. These two parameters serve different purposes:

  • width=device-width: Matches the viewport width to the device width rather than a fixed value. It is a suitable starting point for pages that need to work across screen sizes.
  • initial-scale=1: Controls the zoom level when the page first loads; it does not prevent users from zooming in later.

For example, width=500 sets a fixed width and serves a different purpose from device-width. If the page needs to adapt to different devices, a fixed value should not be treated as a universal setting.

If the site uses a CMS, first check whether the page already has a viewport tag. The article notes that most CMS platforms add it automatically, so not having added it manually does not mean it is missing.

Check for Content Extending Beyond the Screen

awoo’s 2019 article notes that CSS can also cause content to extend beyond the screen on mobile devices. A viewport tag therefore does not guarantee a readable layout. Check the content layout as well as the tag.

  • Reading requires horizontal scrolling: Check content widths, positioning settings, and whether images scale with the layout. Do not just keep changing the viewport settings.
  • Text is hard to read: Check whether the actual font size is comfortable to read. Zooming out the entire page is not the solution.
  • Buttons or links are easy to tap accidentally: Check the size and spacing of touch targets such as buttons and links. This requires layout adjustments; viewport settings alone cannot fix it.

Let Users Zoom and Set Advanced Parameters as Needed

Do not simply add user-scalable=no to keep the display fixed. Semrush’s 2023 article cautions that disabling zoom affects accessibility and the reading experience. For people who need to enlarge text, a tidy layout does not necessarily make the content easy to read.

minimum-scale and maximum-scale limit how far users can zoom out and in, respectively; they are not required for a basic setup. If the page only needs to match the device width, start with width=device-width and initial-scale=1. Then adjust based on how well reading, zooming, and interaction work across devices, rather than adding a long list of restrictions upfront.

ProcrustesPRProcrustesPRWhy can I not find my published article on Google?

Viewport tag settings: perspectives from across the web

Can viewport behavior be adjusted when the virtual keyboard appears?

Yes. Depending on the page’s needs, consider using interactive-widget to set how the viewports respond when the virtual keyboard appears:

  • resizes-visual: Resizes only the visual viewport.
  • resizes-content: Resizes both the visual and layout viewports.
  • overlays-content: Resizes neither viewport.

If the virtual keyboard might cover input fields, test on actual devices to assess which behavior works best for the page.

Will all browsers honor zoom restrictions?

Not necessarily. Semrush’s 2023 article notes that browsers may handle zoom attributes differently: Apple has ignored zoom-related meta elements since iOS 10, and other browsers may allow users to force-enable zoom through accessibility settings. The tag should therefore not be treated as a restriction that every device enforces consistently. Test reading and zooming in practice.

How can you check whether a website is missing viewport tags?

You can scan the website with Semrush’s Site Audit, then look under the Mobile SEO category in the issue list for pages with missing tags and instructions for fixing them. This type of check helps identify missing tags. However, even when a tag is present, you still need to check the layout and readability on devices; scan results alone cannot establish that the page displays correctly.

ProcrustesPREight SEO essentials for beginners: Website speed

References

  1. Mobile SEO必學!行動版網站健檢Search Console幫你做www.awoo.ai · 2019-06-24T00:38:34+00:00 — Discusses: How can you check whether a website is missing viewport tags?
  2. A Beginner’s Guide to Viewport Meta Tagswww.semrush.com · 2023-11-08T14:00:00Z — Discusses: Can viewport behavior be adjusted when the virtual keyboard appears?; Will all browsers honor zoom restrictions?

Related articles

How should I divide my DIY SEO budget?Why can I not find my published article on Google?Eight SEO essentials for beginners: Website speedEight SEO essentials for beginners: Getting your pages indexedEight SEO essentials for beginners: Page titles and descriptionsThe Five Most Common Mistakes SEO Beginners MakeHow to Set Up Heading Tags for SEO: Define Topics and Hierarchy Before Adding KeywordsWhat are the benefits and development challenges of SPAs?
ProcrustesPR
ProcrustesPR