Sidebar
A short card that is done on the first page.
FIRST
Every layout engine has to decide what happens when a box is taller than the page it started on. A browser slices the box where the page ends and carries the rest over to the top of the next one. The border that would have closed the box at the bottom is left out, because the box is not finished. Text is the easiest thing to break, since a paragraph already knows where its lines are. An image cannot be broken, so it moves whole to the page that has room for it, and a gap stays behind. Tables have been cut between their rows for years, and a flex container is cut between its lines in the same spirit. The harder case is a line whose items are themselves tall: two columns of prose side by side, say. Each column is cut at the same height, and each continues on the next page from the point it reached. The widths of the columns must not change on the way, or the second page would not look like the first.
A sidebar that ended early still holds its place, so the columns beside it keep their positions. Padding at the top of a continued item would open a false gap, so the continuation starts flush. Backgrounds go on filling the box down to the cut and pick up again from the top of the next page. A declared height is shared between the parts: the first takes what it showed, the second keeps the rest. None of this is visible on a page that has enough room; it only matters where the room runs out. The reader should notice nothing but a page turn in the middle of a sentence, which is what happens in print. Widows and orphans are still left to the paragraph, which refuses to leave a single line on its own. When nothing at all fits above the cut, the whole line waits for the next page rather than leaving an empty sliver. The page count is what the comparison checks, since the exact line of the cut depends on the font metrics.
SECOND
A fixture like this one is deliberately taller than a page, so the cut has to fall somewhere inside it. Each sentence here is different from the others, because a similarity score on repeated text is meaningless. Long documents with columns are common in reports, where a summary sits beside the body of the text. The rules come from CSS Fragmentation, which describes how boxes are broken across pages and columns. Flexbox itself says little about page breaks; the fragmentation module fills that gap for every layout mode. What a print engine gets wrong here shows up as duplicated or missing lines, which readers notice at once. Keeping the head of the container frozen avoids laying it out twice with possibly different results. Only the tail is measured again, at the width of the frame that receives it, with the old widths pinned. A nested container inside a column is cut through in the same way, by asking it to split at the same height. The result is a document whose pages read continuously, column by column, from the first page to the last.
Tables have been cut between their rows for years, and a flex container is cut between its lines in the same spirit. The harder case is a line whose items are themselves tall: two columns of prose side by side, say. Each column is cut at the same height, and each continues on the next page from the point it reached. The widths of the columns must not change on the way, or the second page would not look like the first. A sidebar that ended early still holds its place, so the columns beside it keep their positions. Padding at the top of a continued item would open a false gap, so the continuation starts flush. Backgrounds go on filling the box down to the cut and pick up again from the top of the next page. A declared height is shared between the parts: the first takes what it showed, the second keeps the rest.