Collection and sorting of attributes such as container size, positioning, and distance in js _ javascript skills

Source: Internet
Author: User
The container size, positioning, distance, and so on are widely used in practice. I would like to share with you the js-related code compiled in small series. If you have such a need, refer to it, I hope to help you with element. clientWidth // The actual width of the element, not the border

Element. clientHeight // The actual height of the element, not the border


Element. offsetWidth // The actual width of the element and the border

Element. offsetHeight // The actual height of the element and the border


Element. scrollWidth // This Is A Lot Of a saying. I tested it to be the actual width of the element-the width of the scroll bar.

Element. scrollHeight // There are many sayings about this. I tested the actual height of the element-the height of the scroll bar.


Element. offsetLeft // The distance from the parent object. In ie, if the position is set to relative, It is the distance from the window.

Element. offsetTop // The distance from the parent object. In ie, if the position is set to relative, It is the distance from the window.


Window. screenLeft // The distance from the current window to the screen is only for IE

Window. screenX // The distance between the current window and the screen is not for IE


Window. innerWidth // current window size (inner) not for IE

Window. outerWidth // current window size (outside) not for IE


Window. screen. width // current screen resolution

Window. screen. availWidth // available resolution of the current screen
Related Article

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.