How to dynamically get the content height of a div using AngularJS ? Read Discuss Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report 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 clientHeight property and scrollHeight property 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. Element.clientHeight property: This is used to return the viewable height of an element in terms of the pixel. Element.scrollHeight property: This is used to return the height 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. HTML <head> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script> <style> #div1 { height: 100px; width: 300px; border: 2px solid black; overflow: scroll; } h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h3>Getting Content height</h3> <div id="div1"> Calculate content height of a div on GeeksforGeek. GeeksforGeeks is a computer science portal which helps students to learn various programming language and master data structures and algorithms. There are various courses available to learn new skills. </div> <br> <button onclick="contentheight()"> Content height of Div </button> <p id="p1"></p> </center> <script> function contentheight() { var ans = "Content-height: " + angular.element(document .getElementById("div1").clientHeight) + "px<br>"; document.getElementById("p1").innerHTML = ans; } </script> </body> 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. HTML <head> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script> <style> #div1 { height: 100px; width: 300px; border: 2px solid black; overflow: scroll; } h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h3>Getting Content height</h3> <div id="div1"> Calculate content height of a div on GeeksforGeek. GeeksforGeeks is a computer science portal which helps students to learn various programming language and master data structures and algorithms. There are various courses available to learn new skills. </div> <br> <button onclick="contentheight()"> Content height of Div </button> <p id="p1"></p> </center> <script> function contentheight() { var ans = "Content-height: " + angular.element(document .getElementById("div1").scrollHeight) + "px<br>"; document.getElementById("p1").innerHTML = ans; } </script> </body> Output: Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Last Updated : 24 Jan, 2023 Like Article Save Article Previous How to count array items in AngularJS ? Next How to create animated banner links using HTML and CSS?