Page width and height, window width and height, element width and height, element location, Page scrolling distance

Source: Internet
Author: User

Page width and height:

Document. Body. clientwidth/height (excluding margin)

Document. Body. offsetwidth/height (excluding margin)

Document. Body. scrollwidth/height (including margin)

TIPS:

1. if the browser window is not maximized and Min-width, document. body. offsetwidth is later than document. body. 2 PX more clientwidth, which is the 2px space next to the scroll bar.

2. Sometimes, overflow: hidden is not set; the image will support the page width. In this case, the page width value with a horizontal scroll bar is incorrect.

Window viewport width and height:

Window. innerwidth/height (with a scroll bar)

Document.doc umentelement. clientwidth/height (without a scroll bar)

Element width and height:

Element. offsetwidth/height (width + padding + Border)

Element. scrollwidth/height (width + padding, Without Border)

Element location:

 

Page width and height, window width and height, element width and height, element location, Page scrolling distance

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.