Mobile Web page Adaptation scheme

Source: Internet
Author: User

Conceptual understanding Viewport Viewport
    • Visual viewport visible viewport, device screen width windw.innerwidth/height
    • Layout viewport layouts viewport, Dom width Document.documentelement.cliendwidth/heig
    • Ideal viewport Ideal viewport: The goal is to set the default layout viewport width to the screen width of the mobile device
      • Visual viewport = Layout Viewport * Scale
<meta name= "viewport" content= "width=device-width,initial-scale=1" >
Width:viewport width
Initial-scale: page Initial Zoom
Maximum/minimum-scale: Minimum/maximum scale allowed for user scaling
User-scalable:yes/no whether the user is allowed to scale manually
Some things in pixels physical pixels (physical pixel)

Device pixels, the smallest physical part in a device. For example, one screen, twice times screen (Retina), three times times the screen refers to how many physical pixels to display a CSS pixel. Retina screen, a CSS pixel corresponds to 4 physical pixels.

CSS pixels

CSS pixels are abstract units that are used primarily in browsers. CSS is called device-independent pixels (device-independent pixel) abbreviated dips.

Early Iphone3 resolution is the resolution of the 320x480,retina screen 640x960, the screen size is constant but the pixels are increased by one times. At this point, a CSS pixel equals two physical pixels.

Device pixel ratio DPR (pixel ratio)

Device pixel ratio = physical pixel/device independent pixels (IPHONE,DPR = 2 for Retina screen, i.e. 1css pixels equals 2 physical pixels)

The scale and DPR of viewport are reciprocal.

    • JavaScript:window.devicePixelRatio
    • CSS:-webkit-device-pixel-ration,-webkit-min-device-pixel-ratio,-webkit-max-device-pixel-ratio

The relevant method of front-end adaptation: viewport

Http://caibaojian.com/mobile-responsive-example.html

Https://www.cnblogs.com/2050/p/3877280.html

1190000008767416#articleheader7

Https://github.com/riskers/blog/issues/18

Mobile Web page Adaptation scheme

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.