docs.rodeo

MDN Web Docs mirror

{{HTMLSidebar}} 

The viewport value for the name attribute of a {{htmlelement("meta")}}  element gives hints about the initial size of the {{glossary("viewport")}} . If specified, you define viewport-related behaviors using a content attribute in the <meta> element as a comma-separated list of one or more values.

For example, to set the viewport to match the device’s width and display content at 100% zoom:

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

Usage notes

A <meta name="viewport"> element has the following additional attributes:

Examples

Using a meta viewport size

The following example indicates to the browser that the page should be rendered at the device width:

<meta name="viewport" content="width=device-width" />

Using a media query with a viewport meta

The following content value uses multiple keywords that hint to the browser to use fullscreen mode, along with viewport-fit, which helps avoid display cutouts such as mobile device notches:

<meta
  name="viewport"
  content="width=device-width, initial-scale=1.0, viewport-fit=cover" />

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN