![]() |
VOOZH | about |
In this article, we will see how to get the height of the content of a <div> dynamically using Javascript, & will understand its implementation through the illustrations.
The content height of a div can dynamically get using the clientHeightproperty and scrollHeightproperty depending upon the user's requirement. If a user wants to know the space required by actual displayed content including the space taken by padding but not including the scrollbars, margins, or borders, then the user can use any of the following procedures that will return the height of the entire content of an element.
Example 1: In this example, the content Height of div using the clientHeight property will return the height of the entire content of an element.
Output:
Example 2: In this example, the content Height of div using the scrollHeight property will return the height of the entire content of an element.
Output: