Mobile page Size setting (i)

Source: Internet
Author: User

Reference: http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-dont-forget-the-viewport-meta-tag/

First, the homepage mobile phone wap2.0 page of the head to add the following meta tag, in the iphone browser page will be displayed in the original size, does not allow zooming.

Where: Width-viewport width height-viewport height initial-scale-Initial zoom ratio
Minimum-scale-Allows the user to zoom to the minimum scale Maximum-scale-allows the user to zoom to the maximum scale user-scalable-
Whether the user can manually scale C

Ii. for a detailed introduction to Meta, please refer to

Third, the following is a detailed introduction to the meta example of the original address

3. Meta element Visual area

By default, Safari on the iphone will display your page as if it were on a big screen desktop browser, with a width of 980 pixels, and then zoom out to fit the iphone's small screen, so users feel less and more blurry when they look at this page on their iphone. You have to zoom in to make it look real, it seems acceptable for a normal web page, but few people can tolerate a common application.

Fortunately, a special meta element can be used to correct the visual area:

<</span>meta
Name= "Viewport" content= "Width=device-width"/>

This element tells the browser to use the width of the device as the width of the viewable area, rather than the default of 980 pixels, we can look at two different examples.

Example 3 (link: http://www.sitepoint.com/examples/iphone-development-12tips/no-viewport.html) shows a simple paragraph element with no meta element visible area, The font is a little blurry. The actual operation in the iphone is as shown.

Figure 1 No visible area display effect

Example 4 (link: http://www.sitepoint.com/examples/iphone-development-12tips/viewport.html) includes a visual area element that now has a device width of only 320 pixels, The font is also clearer than the previous example. The actual operation in the iphone is as shown.

Figure 2 shows the visible area

In addition, you can manually set the value of the device-width, for example, if your blog page width is 750 pixels, then the best size of the desktop screen is 800x600 pixels, example 5 (Link: http://www.sitepoint.com/examples/ iphone-development-12tips/fixed750.html) shows a truncated version, if you browse it in the iphone, you'll see that the remaining space in 980 pixels is filled with white.

To eliminate extra space, you can use the Meta element visual area to set the width to 780 pixels:

<</span>meta
Name= "Viewport" content= "width=780"/>

Example 6 (link: http://www.sitepoint.com/examples/iphone-development-12tips/fixed750-viewport.html) shows the effect of the Meta element visual area layout being fixed.

The contents of the META element viewable area can include multiple comma-separated values, such as initial-scale–
The magnification level at which the user initially sees the page, and a common setting for the Web application is:

<</span>meta
Name= "Viewport" content= "Width=device-width,initial-scale=1,user-scalable=no"/>

This element sets the width to the maximum width of the device, preventing users from zooming in and out

Mobile page Size setting (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.