Web window pixel and other notes

Source: Internet
Author: User

Original: http://www.w3cplus.com/css/viewports.html

Screen size Screens size = display size

Screen.width and Screen.height. These two properties contain the full width height of the user's screen. These dimensions are defined using the pixels of the device, and their values are not changed by scaling: they are features of the display, not the browser copyrights owned by the author.

Browser size Window size = Browser size Window.innerwidth/height
    • Meaning: Full size of browser with scroll bar size
    • Metrics: pixels of CSS
    • Compatibility issues: IE does not support, opera with device pixels to measure

Instead, you want to know the internal dimensions of the browser. It defines how much of the current user area is available for your CSS layout to occupy. You can get it through window.innerwidth and Window.innerheight.

Window.pagexoffset and Window.pageyoffset define the horizontal, vertical displacement of the page (document) relative to the window origin. So you can locate how many scroll bars the user has scrolled.

Measure viewport measuring the view portdocument. DocumentElement. Clientwidth/height
    • Meaning: size of viewport
    • Metrics: pixels of CSS
    • Compatibility issue: None

You may want to know the size of the viewport and they can pass the document. DocumentElement. Clientwidth/height to get it.

Rolling displacement scrolling Offsetwindow.pagex/yoffset
    • Meaning: See description
    • Metrics: pixels of CSS
    • Full support: IPhone, Android, Symbian, Iris, MicroB, Skyfire, Obigo
    • Problem:
      • Opera, Bolt, Firefox, and NetFront always return 0.
      • Samsung's WebKit Core browser is correctly represented only when the label is written on the page.
    • Not supported: IE, it uses document. Scrollleft/top to say

Web window pixel and other notes

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.