Some properties and methods for calculating htmlelement dimensions

Source: Internet
Author: User

Properties:

ClientHeight: Returns the height (in pixels) of the element, including the padding, but not the horizontal scroll bar, border, and margin.

ClientWidth: Represents the inner width of the element, in pixels. This property includes the padding, but does not include the vertical scrollbar (if any), border, and margin.

ClientTop: The width of the top border of an element, expressed in pixels. Does not include the top margin or the inner margin. ClientTop is read-only.

ClientLeft: Represents the width of the left border of an element, expressed in pixels. If the text direction of an element is right-to-left (RTL, Right-to-left), and because a content overflow causes a vertical scroll bar to appear to the left, the property includes the width of the scrollbar. Excludes clientLeft left margin and left padding. clientLeftis read-only.

ScrollHeight: A read-only property that measures the content height of an element, including overflow style properties that result in views that are not visible. In the absence of a vertical scrollbar, the scrollheight value is clientheight the same as the minimum value required for the element view to populate all content. Includes the padding of the element, but does not include the margin of the element.

ScrollWidth: The value scrollWidth只读属性以px为单位返回元素的内容区域宽度或元素的本身的宽度中更大的那个值。若元素的宽度大于其内容的区域(例如,元素存在滚动条时), of the element's scrollwidth is greater than clientwidth.

ScrollTop: Sets or gets the pixel distance of an element from the top of his container. One element scrollTop is the ability to calculate the visible height of the element from the top of its container. When the container of an element does not produce a vertical scroll bar, then it's scrollTop 的值默认为0 .

ScrollLeft: Reads or sets the distance of the element scroll bar to the left of the element.

Some properties and methods for calculating htmlelement dimensions

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.