THE GITHTML FIELD GUIDE
Keep a figure and caption together in print output
Wrap an image and its caption in a figure and use break-inside cautiously to discourage separation during printing. This is a preference, not a guarantee when the figure is larger than a page. Keep the caption informative and allow oversized material to split or scale through a deliberate print-specific decision.
Choose the right representation
A caption stranded on the next page can make the preceding image difficult to interpret. The problem is grouping during fragmentation, not simply adding more bottom margin. A semantic figure provides a natural container for the relationship.
Apply the pattern deliberately
Apply break-inside: avoid to small figures in print styles. Do not apply it indiscriminately to every large section, because an unbreakable section may create substantial empty space or overflow. For a tall screenshot, consider a cropped detail with an explanation rather than shrinking labels beyond usefulness.
- Group the image and its meaningful caption in the same figure element.
- Limit break avoidance to units that can reasonably fit on one printed page.
- Review the largest figure separately and choose a readable print treatment for it.
@media print { figure { break-inside: avoid; } }Plan for the figure that cannot fit
Measure the problematic figure against the printable area, not the full paper size. Page margins, headers, footers, and the caption all consume space. If the image and caption together exceed one page, a break-avoidance preference cannot create more room. Decide whether to use a landscape page, a smaller but still readable image, or several labeled details. Explain which view is the overview and which views are enlargements so the printed sequence remains understandable.
Avoid making an entire chapter unbreakable simply because it contains a figure. That can push a large block to the next page and leave unexpected blank space before it. Apply the grouping to the smallest meaningful unit. If a caption contains several paragraphs, move general discussion into the surrounding prose and leave the figure's identification and essential explanation together. This reduces the amount that must travel as a single unit without deleting useful context.
Inspect a figure near the beginning, middle, and bottom of a printed page. Change the paper size or margin setting once to expose assumptions tied to your own preview. Check that the caption number still matches any cross-reference in the text and that a printed crop has not removed a scale, axis label, or important control. A readable PDF export is a separate deliverable from an attractive screen layout; verify both when the report promises both.
Check the finished reading experience
Inspect the print preview where the figure falls near a page boundary. Test more than the first page, because the issue depends on accumulated content and paper settings.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.