Generated by GPT-5-mini| CSS Fragmentation Module | |
|---|---|
| Name | CSS Fragmentation Module |
| Developer | World Wide Web Consortium |
| Type | Cascading Style Sheets |
| First | Cascading Style Sheets Level 3 |
| Status | Draft |
| Website | W3C Working Draft |
CSS Fragmentation Module
The CSS Fragmentation Module specifies how content is broken into multiple pieces across print pages, viewport regions, or multi-column layouts. It extends the Cascading Style Sheets Level 2 and Cascading Style Sheets Level 3 models to control breaks, avoid orphans and widows, and govern fragmentation flows used in contexts like HTML5 print-outs, SVG rendering, and Microsoft Word-like pagination engines. The module interfaces with specifications such as Paged Media Module, Fragmentation proposals in W3C, and implementations in browsers like Google Chrome, Mozilla Firefox, and Apple Safari.
The module provides properties to influence how elements are split across fragmentation contexts defined by CSS2 and CSS3 standards, interacting with the CSS Box Model, CSSOM, and the Document Object Model. Authors can manage break opportunities, control decoration and clipping at fragment boundaries, and define break-inside rules that apply to content flows similar to pagination in LaTeX, or printing in Adobe Acrobat and Microsoft Edge. The specification cross-references related work from WHATWG, the International Organization for Standardization, and research from institutions such as MIT and Stanford University.
Fragmentation introduces vocabulary such as fragmentainer, fragment, fragmentainer-child, and break token modeling that relate to concepts in Paged Media Module, Box Fragmentation, and the historical Flowed Content proposals. Key terms align with terminology used by W3C Working Group discussions alongside examples from HTML4, HTML5, and presentation technologies like XHTML and CSS Regions. The module also borrows conceptual parallels from pagination systems in TeX, ConTeXt, and layout engines used by WebKit and Gecko.
Properties include break-before, break-after, break-inside, orphans, widows, and box-decoration-break, with syntax compatible with existing CSS2 shorthand and CSS Syntax Module Level 3 rules. The module formalizes values such as auto, always, avoid, avoid-page, avoid-column, avoid-region, and page-specific identifiers that interoperate with @page rules and named pages defined in Paged Media Module. Declarations follow standard cascade and inheritance principles described in Cascading Style Sheets Level 2 Revision 1 and interact with specificity algorithms from CSS2 selectors like :first-child and :last-child. The spec also details fragmentation-aware at-rules and pseudo-elements comparable to ::before and ::after behaviors documented by WHATWG and W3C.
Fragmentation contexts occur within multi-column layout, paged media, and generated regions such as those created by CSS Regions or Grid Layout Module. The behavior ties into painting and stacking contexts as governed by CSS Positioned Layout and Compositing and Blending rules from CSS Transforms Module and CSS Flexbox Layout Module. The UA formatting model in engines like Blink and Servo resolves break constraints considering floats, positioned elements, and replaced elements used in SVG and Canvas integrations developed by WHATWG contributors. Interaction with pagination engines echoes techniques from PrinceXML and Paged.js.
The module prescribes how pagination interacts with multi-column flows, specifying resolution strategies when break-inside conflicts arise between column breaks and page breaks similar to conflict resolution strategies in PDF renderers and Microsoft Word pagination. It clarifies precedence among break-* properties, page-break-* legacy aliases from CSS2, and new mechanisms for named fragmentainers used in sophisticated print layouts crafted by designers familiar with Adobe InDesign workflows. The rules also inform user agent decisions for Widows and Orphans handling, reflecting practices in typographic standards such as those promulgated by Monotype and Linotype.
Support varies across engines: implementations exist in Blink-based browsers like Google Chrome and Microsoft Edge (Chromium) with partial features, in Gecko-based Mozilla Firefox with different coverage for break-inside values, and in WebKit-based Apple Safari where box-decoration-break and orphan/widow handling diverge. Polyfills and libraries such as Paged.js, server-side tools like PrinceXML, and layout engines used by WeasyPrint provide alternate fragmentation behaviors. Standardization progress and issue tracking occur within W3C Community Group repositories and vendor issue trackers maintained by organizations like GitHub and Bugzilla.
Common use cases include printing long-form HTML5 documents for academic publishing workflows at institutions such as Oxford University Press and Springer Nature, generating invoices and reports in enterprise stacks used by Salesforce and SAP, and producing multi-column magazine layouts comparable to The New Yorker or National Geographic web replicas. Examples demonstrate controlling page breaks around headings from IEEE or ACM publications, keeping images and captions from splitting as in Reuters photo layouts, and preventing table row fragmentation akin to techniques used by The Guardian and New York Times interactive articles. Sample code often pairs break-* properties with @page rules and column-count from CSS Multi-column Layout Module to achieve predictable printed output.