To understand these attributes, first understand the difference between body,documentelement
1. Body is the body child node in DOM object, i.e. <body> tag
2. DocumentElement is the node of the whole node tree, that is, the
========================, the following are all nonsense ==================================
Many people think that the body and HTML are the same, judging by the body with the background color, the entire Web document will be followed by color. In fact, this phenomenon does not mean that the body and the HTML node is the same thing, this is caused by inheritance.
We all know that inheritance refers to the child element inherits some of the attributes of the parent element, body as the child node of the HTML, theoretically there is no HTML Inheritance Body property, but there is an exception, HTML inherits the body's Background property, This causes the body to add a background color to the entire HTML followed by discoloration. (You can try to add a height to the body, set the background color, and then set the HTML another background color, see the effect)
Therefore, the new Web page in the case of no content, the body height is equal to 0, as the content increases, the body height increases with it
======================== nonsense over =======================================
Understand the difference between body and HTML to understand innerheight,clientheight,offsetheight, each browser returns different values, the root cause is that the base of the calculation is different :
1, document.body to the BODY element for the calculation of the benchmark
2, document.documentelement with HTML as the benchmark
IE, Opera thinks offsetheight = clientheight + scroll bar + border.
Chrome, FF thinks offsetheight is the actual height of the Web content, can be less than clientheight.
IE knows that version 11 is only modified to be consistent with CHORME,FF
A word to understand the difference and usage of innerheight, (document.documentelement,document.body)/Clientheight,offsetheight