Web Screen size related finishing

Source: Internet
Author: User

ClientWidth is the width that the object sees (without edges, that is, border)
ScrollWidth is the width of the actual content of the object (if there is no padding, that is the distance between the borders, if there is padding, the distance between the left padding and the right padding).
Offsetwidth refers to the width of the object itself, the integer type, in pixels (with edges, such as the width of the scroll bar, and the value changes as the content is entered).

ScrollHeight: Gets the scroll height of the object.
ScrollLeft: Sets or gets the distance between the left edge of the object and the leftmost of the currently visible content in the window
ScrollTop: Sets or gets the distance between the top of the object and the top of the visible content in the window
ScrollWidth: Gets the scrolling width of the object
Offsetheight: Gets the height of the object relative to the layout or parent coordinates specified by the parent coordinate OffsetParent property
Offsetleft: Gets the calculated left position of the object relative to the layout or the parent coordinate specified by the OffsetParent property
OffsetTop: Gets the computed top position of the object relative to the layout or the parent coordinate specified by the OffsetTop property

Easy to confuse points:

ClientX Sets or gets the x-coordinate of the position of the mouse pointer relative to the current window, where the customer area does not include controls and scroll bars for the window itself.
ClientY Sets or gets the y-coordinate of the position of the mouse pointer relative to the current window, where the customer area does not include controls and scroll bars for the window itself.
OffsetX Sets or gets the x-coordinate of the position of the mouse pointer relative to the object that triggered the event.
OffsetY Sets or gets the y-coordinate of the position of the mouse pointer relative to the object that triggered the event.
ScreenX Sets or gets the x-coordinate that gets the position of the mouse pointer relative to the user's screen.
ScreenY Sets or gets the y-coordinate of the mouse pointer position relative to the user's screen.
x Sets or gets the X-pixel coordinates (that is, relative to the current window) of the position of the mouse pointer in relation to the parent document.
Y Sets or gets the Y-pixel coordinates (that is, relative to the current window) of the position of the mouse pointer in relation to the parent document.

Document.documentElement.scrollTop The vertical scrolling value
event.clientx+document.documentelement.scrolltop Horizontal coordinates of relative documents + amount of vertical scrolling
the above mainly refers to IE, Firefox differences are as follows:
IE6.0, ff1.06+:
clientwidth = width + padding
clientheight = height + padding
offsetwidth = width + padding + border
offsetheight = height + padding + border
ie5.0/5.5:
clientwidth = Width-border
clientheight = Height-border
offsetwidth = width
offsetheight = height (need to mention: Margin attribute in CSS, regardless of clientwidth, offsetwidth, ClientHeight, offsetheight)


Web page Visible area width: document.body.clientWidth;
Web page Visible Area High: document.body.clientHeight;

Web page Visible Area width: document.body.offsetWidth (including the width of the edge);
Web page Visible Area High: document.body.offsetHeight (including the width of the edge);

Page body Full text width: document.body.scrollWidth;
Page body Full text High: document.body.scrollHeight;

The page was rolled High: document.body.scrollTop;
The webpage is rolled away left: document.body.scrollLeft;

Page body part: window.screentop;
Page body part left: window.screenleft;

High screen resolution: window.screen.height;
Width of screen resolution: Window.screen.width;

Screen available working area height: window.screen.availHeight;
Screen available working area width: window.screen.availWidth;

Web Screen size related finishing

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.