English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
scrollHeightA read-only property that returns the entire height of the element (in pixels), including content that is not visible on the screen due to overflow.
The method of measuring height is the same asclientHeightSame: it includes the padding of the element, but not its border, margin, or scrollbar.
It can also include the height of pseudo-elements, such as:: beforeor:: afterIf the content of the element can be contained without a vertical scrollbar, then its scrollHeight is equal toclientHeight.
Usage:scrollWidthThe property returns the entire width of the element.
element.scrollHeight
var elem = document.getElementById("box"); var y = elem.scrollHeight; var x = elem.scrollWidth;Test See‹/›
The numbers in the table specify the first browser version that fully supports the scrollHeight property:
Property | |||||
scrollHeight | 4 | 3 | 10 | 4 | 8 |
Return Value: | A number representing the entire height of the element in pixels |
---|---|
DOM Version: | CSS Object Model (CSSOM) |
HTML DOM Reference:scrollWidth property
HTML DOM Reference:clientHeight property
HTML DOM Reference:offsetHeight property
CSS Reference:overflow property