Search code examples
htmlviewportmeta-tags

What is the <meta name="viewport"> tag?


What is

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

Like part by party I want to learn HTML and am using a webpage from a club I joined


Solution

  • From W3schools:

    HTML5 introduced a method to let web designers take control over the viewport, through the tag.

    You should include the following viewport element in all your web pages:

    <meta name="viewport" content="width=device-width, initial-scale=1.0"> This gives the browser instructions on how to control the page's dimensions and scaling.

    The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).

    The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.

    About the meta tag W3schools:

    The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data.

    <meta> tags always go inside the element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.

    Metadata will not be displayed on the page, but is machine parsable.

    Metadata is used by browsers (how to display content or reload page), search engines (keywords), and other web services.

    There is a method to let web designers take control over the viewport (the user's visible area of a web page), through the tag (See "Setting The Viewport" example below).