A primary block-level container is the block-level container formed by a specific element that is directly influenced by the style rules applied to it.
Most elements typically create only one container. In these cases, they essentially represent the same entity, as no additional containers are present.
However, depending on its display type, an element can generate multiple containers, such as a list item. When you define styles for such an element, these styles usually affect the primary container, while any extra containers generated will be displayed according to those styles.
For instance, a list item includes a marker container alongside the primary container; if you set list-style-position: outside
, the list marker will appear outside the primary container's borders without affecting its background and borders. It's important to note that the marker container is still considered a descendant of the primary container, so inheritable properties like color
will also apply to the marker (which explains why setting color: red
turns both the text and bullet marker red).
Most other block-level elements, like those with display: block
(excluding display: table
- refer to section 17.4), generally produce a primary block container for their content exclusively, distinguishing them as simply "block containers", but solely within these particular elements.
In essence, all primary block-level containers are block-level containers, yet not every block-level container is deemed primary - for example, anonymous block containers. Additionally, inline elements, including inline blocks, do not individually form primary containers, nor does the concept extend to defining a primary inline container.