Ladies and gentlemen, there are a number of blocks, for example <p> . How do I get the sum of the height of the blocks? The method given below in the example of something does not work, I do not understand what the matter is ...
var par = document.getElementsByTagName('p'); for (var i = 0; i < par.length; i++) { var parHeight = +par[i].getBoundingClientRect().height; } console.log(parHeight); p { width: 50%; height: 100px; background: gray; margin: 20px; } <p></p><p></p>