You are here: Reference > JavaScript > client-side > style handling > properties > posHeight

posHeight property

Browser support:
Specifies or retrieves the value of the height style property as a floating-point number that specifies the value in the current unit type of the height property.
With the height style property you can set or return the height of an element with a unit designator as a string. The pixelHeight property specifies or retrieves the height as an integer, in pixels. If you want to set or retrieve the height as a floating-point number that specifies the value in the current unit type of the height style property, use the posHeight property.
The properties mentioned above can be used to access style settings. If you need the height of a rendered element, you can use the clientHeight, offsetHeight and scrollHeight properties and the getBoundingClientRect method.
The currentStyle.posHeight property is read-only, all others are read/write.

Syntax:

object.posHeight;
You can find the related objects in the Supported by objects section below.

Possible values:

Floating-point number that specifies or retrieves the height of the object.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the posHeight property:
<head>
    <script type="text/javascript">
        function GetHeight (elem) {
            var heightStyle = elem.style.height;
            var heightPx = elem.style.pixelHeight;
            var heightPos = elem.style.posHeight;
            alert ("The height of the button: " + heightStyle +
                   "\n without unit type: " + heightPos + 
                   "\n in pixels: " + heightPx);
        }
    </script>
</head>
<body>
    <button style="width:40%; height:10%;" 
            onclick="GetHeight (this);">Get the height!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content