English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM scrollHeight property

HTML DOM Element Object

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.

Syntax:

element.scrollHeight
var elem = document.getElementById("box");
var y = elem.scrollHeight;
var x = elem.scrollWidth;
Test See‹/›

Browser Compatibility

The numbers in the table specify the first browser version that fully supports the scrollHeight property:

Property
scrollHeight431048

Technical Details

Return Value:A number representing the entire height of the element in pixels
DOM Version:CSS Object Model (CSSOM)

Related References

HTML DOM Reference:scrollWidth property

HTML DOM Reference:clientHeight property

HTML DOM Reference:offsetHeight property

CSS Reference:overflow property

HTML DOM Element Object