- 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