(Initial definitions):
Block = element whose
display: block
.Box-model: width, height, padding, border (whpb) dimensions. Margin's not included.
I presume a child element lives in the content-area of their parent (by that I mean the child's box-model properties (& potentially margin) bounce off/stretch the walls of their parent's content-area). If this isn't so, do tell me but also read the rest of my question as if I am just talking about when a child 'lives' in its parent's content-area.
This question presumes all elements have
box-sizing: content-box
.Parental margin-collapsing: when the margin-top of the first child & margin-bottom of the last child collapse with the margin-top & margin-bottom of the parent, respectively.
My understanding of how to determine height
of a block when its height: auto;
When element has no child elements:
0
or when it contains text, the number of lines of text. 1 line of text = value of line-height
.
When element has child elements which themselves have no child elements:
When parental margin-collapsing doesn't take place (perhaps parent has block-formatting-context (BFC)) height
is sum of child elements' box-models + lines of text + margins between them + margin between first & last child and top and bottom edge of parent's content-area. When element parental margin-collapsing does take place its the same formulae but without 'margin between first & last...'.