Boundary superposition is a fairly simple concept. However, when you lay out a Web page in practice, it can cause a lot of confusion. Simply put, when two vertical boundaries meet, they form a boundary. The height of this boundary is equal to the larger of the height of two overlapping boundaries.
When an element appears above another element, the bottom boundary of the first element is superimposed on the top edge of the second element, as shown in figure:
The top boundary of an element is superimposed on the bottom boundary of the preceding element
When an element is contained in another element (assuming that no padding or border separates the boundary), their top and/or bottom boundaries are superimposed, as shown in the figure:
The top boundary of an element is superimposed on the top boundary of the parent element
Although it may seem strange at first, the border can even overlap with itself. Suppose you have an empty element that has boundaries, but no borders or padding. In this case, the top and bottom boundaries come together and they overlap, see figure:
The top boundary of an element is superimposed on the bottom boundary
If this boundary touches the boundary of another element, it will also overlap, see figure:
Superposition of boundaries between an empty element and another empty element
This is why a series of empty paragraph elements occupy a very small amount of space because all of their boundaries are stacked together to form a small boundary.
[1] [2] Next page