You are here: Reference > JavaScript > client-side > HTML DOM > properties > height (document)

height property (document)

Browser support:
Retrieves the height of the document's contents.
In Google Chrome and Safari, if the height of the document's contents is less then the height of the browser window's client area, then it returns the height of the client area.
It is not recommended to use this property.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Integer that represents the height of the document, in pixels.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the height property:
    <script type="text/javascript">
        function GetDocSizes () {
            alert ("width x height: " + document.width + " x " + document.height);
    <button onclick="GetDocSizes ();">Get document dimensions!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content