css2.2 document stipulates:
for elements whose position
is static
or relative
, containing block
is content box
of the most recent ancestor element block container box
(except margin
, border
, padding
);
can be obtained: the containing block of div-sharpinner
is the content area of the box generated by div-sharpouter
. Since the height of this content area is 200px
( div-sharpouter
does not have margin
, border
, padding
), the height of the containing block is also 200px
;
according to the CSS authoritative Guide (P275, fourth Edition):
vertical formatting also has seven related properties: margin-top, border-top, padding-top, height, padding-bottom,border-bottom, and margin-bottom.
The values of these seven properties must equal the height of the block box"s containing block.
you can get 1px
+ 2px
+ 3px
+ 10px
+ 3px
+ 2px
+ 1px
= 200px
;
the conclusion is certainly wrong, but the authoritative guide should not be wrong (the quotation section is the same in both the third and fourth editions of the book), and the document will not be wrong, so there must be something wrong with my own understanding. I hope someone can solve the problem!