Skip to the page
html reference · document

HTML viewport meta tag

type
HTML tag, lives in <head>
applies to
how mobile browsers scale the page
lives inside
<head>
common values
content="width=device-width, initial-scale=1"

Where it goes

Inside <head>, next to the charset and the title. The usual form is <meta name="viewport" content="width=device-width, initial-scale=1">.

Example

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

Open this example in the editor →

Common mistakes

  • Leaving it out, then wondering why your small-screen CSS never kicks in on a real phone. This tag is what makes "narrow screen" true.
  • Adding user-scalable=no to stop pinch-zoom. That hurts people with low vision and is rarely worth it.

Related

Updated 24 October 2026. Practice it in the html route, or read more on MDN.