Reference: CSS 2.2 Visual formatting model
See visual formatting model for a description of these properties.
Here a
forms a block formatting context:
Width, height, padding, margin, and border apply in all directions to block-level elements. See:
Here a
forms an inline formatting context:
Width, height and vertical margins do not apply to inline-level elements. Border, padding and horizontal margins do
apply. Here b
has all properties applied, notice which are ignored:
The contents of a regular inline-level box will participate in the same inline formatting context as its parent.
E.g. here c
is a grandchild of a
but it still participates in a
's inline
formatting context:
Any text directly inside a block container is wrapped in an anonymous inline box. E.g. here "Some text" and "some more text" are wrapped in anonymous inline boxes.
Notice here how text does not flow between lines for the display: inline-block
element as it is an
atomic inline-level box: