Mobile and PC-side viewport

Source: Internet
Author: User
  • Device pixels, which are intuitively "reliable" pixels, provide a normal resolution for the various devices used, and their values can be read from the Screen.width/height attribute (usually);
  • CSS pixels, is the CSS custom pixel, it should be noted that CSS pixels and device pixels is not the same thing;

How to get the screen size:

Can be obtained by using screen.width/height, the value obtained is the overall size of the user's screen;

Unit of measure: device pixels;

Browser: IE7&IE8 has the problem of measuring it with CSS pixels;

Note: There are different differences between iOS and Android;

Window Size:

Window.innerwidth/height, the overall size of the browser window, including the scroll bar, of course, does not include the browser's menu bar, address bar, Unit of measure: CSS pixels, browser IE7 not supported, opera measured in device pixels.

Reference article: see here for details

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.