Easy Tutorial
❮ Css Overflow Css List ❯

Responsive Web Design - Viewport


What is the Viewport?

The viewport is the visible area of the user's web page.

The viewport can be translated into Chinese as "视区".

Mobile browsers place the page in a virtual "window" (viewport), which is usually wider than the screen. This prevents the need to squeeze every web page into a small window (which would disrupt the layout of pages not optimized for mobile browsers). Users can pan and zoom to view different parts of the web page.


Setting the Viewport

A commonly used viewport meta tag for mobile-optimized web pages is as follows:

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

The following examples demonstrate the effect of using and not using the viewport on mobile devices:

Example 1, Without Viewport: Click to View

Example 2, With Viewport: Click to View

If you are accessing on a tablet or phone, you can click to view the effect directly.

❮ Css Overflow Css List ❯