Loading lesson path
The viewport is the user's visible area of a web page. The viewport varies with the device (will be a lot smaller on a mobile phone than on a computer screen).
<meta> element in the <head> section of all your web pages:
Formula
< 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).
Formula
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:
If you are browsing this page with a phone or a tablet, you can click on the two links above to see the difference.
Formula
Users are used to scroll websites vertically on both desktop and mobile devices - but not horizontally!So, if the user is forced to scroll horizontally, or zoom out, to see the whole web page it results in a poor user experience.
Formula
1. Do NOT use large fixed - width elements -
For example, if an image has a width wider than the viewport, it causes the viewport to scroll horizontally. Remember to adjust this content to fit within the width of the viewport.2. Do NOT let the content rely on a particular width to render well