Horje
How to Set The Viewport

The viewport is the user's visible area of a web page. It varies with the device - it will be smaller on a mobile phone than on a computer screen.

You should include the following <meta> 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.

Here is an example of a web page without the viewport meta tag, and the same web page with the viewport meta tag:

Tip: If you are browsing this page with a phone or a tablet, you can click on the two links below to see the difference.







Related Articles
What is HTML Style Guide HTML Style Guide
How to create Always Declare Document Type HTML Style Guide
How to Use Lowercase Element Names HTML Style Guide
How to Close All HTML Elements HTML Style Guide
How to Use Lowercase Attribute Names HTML Style Guide
How to create Always Quote Attribute Values HTML Style Guide
How to create Always Specify alt, width, and height for Images HTML Style Guide
How to create HTML Spaces and Equal Signs HTML Style Guide
How to Avoid HTML Long Code Lines HTML Style Guide
How to create HTML Blank Lines and Indentation HTML Style Guide
How to create Never Skip the <title> Element HTML Style Guide
What is Omitting <html> and <body> HTML Style Guide
What is Omitting <head> HTML Style Guide
How to Close Empty HTML Elements HTML Style Guide
How to Add the lang Attribute HTML Style Guide
What is Meta Data HTML Style Guide
How to Set The Viewport HTML Style Guide
How to set HTML Comments HTML Style Guide
How to use Style Sheets HTML Style Guide
How to load JavaScript in HTML HTML Style Guide
How to access HTML Elements with JavaScript HTML Style Guide
How to Use Lower Case File Names HTML Style Guide
What is File Extensions HTML Style Guide
What is the Differences Between .htm and .html? HTML Style Guide
What is Default Filenames HTML Style Guide


Read Full:
HTML Style Guide
Category:
Web Tutorial
Sub Category:
HTML Style Guide
Uploaded:
1 year ago
Uploaded by:
Admin
Views:
42



Share on: