See this jsFiddle: http://jsfiddle.net/kb2vN/1/
The height of the div 'mytext' as specified in CSS is 100. The total offsetHeight of the 3 paragraphs in the div is 3 * 40 = 120. Its this value (120) that I am after. Why is this value not returned by document.getElementById('mytext').offsetHeight? It would be logical that the offsetHeight of a parent element is the sum of the offsetHeights of its child nodes.
If I do NOT set the height of the 'mytext' div in CSS to 100px, the (in my opinion) correct offsetHeight of 120 is returned. But not setting the height in CSS is not an option in my case.
Why does the offsetHeight of the div correspond to the CSS height, and is there an alternative height property that reflects the actual div height, even if a height is specified in CSS?
By the way, I use Chrome as my web browser.
EDIT I realize that I haven't been totally clear on the purpose of all this. In the end I want to check whether the actual contents of a div (that are put in the div dynamically) do not cause the div to take up more than a specified maximum height (by comparing the div's offsetHeight to the max. height allowed). Since I want to check in JavaScript whether this is the case, using properties like min-height or max-height does not seem to make sense.