0520 Day Focus: css pixels, device pixels, and DPR

Source: Internet
Author: User

1, device independent pixels: the physical pixels of the device screen, the number of physical pixels of any device is fixed

2, css pixels (css pixels): Also known as logical pixels, is created for Web developers, in CSS and JavaScript used in an abstract layer

3. The ratio of device pixels to CSS pixels when the device pixel ratio DPR (devicepixelratio) is the default scaling to 100%

In fact, the CSS pixel at this point corresponds to the ideal viewport to be mentioned later, and its corresponding JavaScript attribute is Screen.width/screen.height

For device pixels, there is a corresponding JavaScript attribute than DPR Window.devicepixelratio

Take iphone5 as an example, the iphone5 CSS Pixel is 320PX*568PX,DPR is 2, so its device pixel is 640px*1136px

0520 Day Focus: css pixels, device pixels, and DPR

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.