A principal block-level box is the block-level box generated by a given element that's directly affected by style rules that apply to the element.
Most elements generate only one box. For these elements, they are essentially the same thing, since there are no other boxes involved.
However, an element can generate more than one box depending on its display type, such as a list item; when you declare styles for such an element, the styles are typically applied to the principal box and any additional boxes that are generated will be rendered accordingly.
For example, a list item has a marker box in addition to the principal box; if you specify list-style-position: outside
, the list marker will be placed outside the boundaries of the principal box but the background and borders of the principal box won't be affected. Note that the marker box is still a descendant of the principal box, so inheritable properties such as color
will apply to the marker (this is why color: red
turns both the text and its bullet marker red).
Most other block-level elements, including display: block
but excluding display: table
(see section 17.4), will simply generate a principal block box for their content and nothing else, making them essentially just "block boxes", but only for those elements.
In other words, all principal block-level boxes are block-level boxes, but not all block-level boxes are principal, for example anonymous block boxes. Also, inline elements, including inline blocks, do not generate any principal boxes themselves, nor is there such a thing as a principal inline box.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…