CSS Generated Content for Paged Media Module Level 4

Editor’s Draft,

This version:
Issue Tracking:
Inline In Spec
W3C Bugzilla
(Hachette Livre)
(Disruptive Innovations)
Not Ready For Implementation

This spec is not yet ready for implementation. It exists in this repository to record the ideas and promote discussion.

Before attempting to implement this spec, please contact the CSSWG at www-style@w3.org.


Level 4 of GCPM proposes a region-based approach to footnotes and running heads.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc.

Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

GitHub Issues are preferred for discussion of this specification. When filing an issue, please put the text “css-gcpm-4” in the title, preferably like this: “[css-gcpm-4] …summary of comment…”. All issues and comments are archived, and there is also a historical archive.

This document was produced by the CSS Working Group (part of the Style Activity).

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 September 2015 W3C Process Document.


There have been many proposals for using CSS to move document content, often motivated by the desire for magazine- or book-style layout of footnotes, running heads, pull quotes, sidebars, and so on. [CSS3GCPM] used float: footnote and position: running(). The now-abandoned [CSS3GENCON] Working Draft used content: footnote. PrinceXML (and older GCPM drafts) has content: flow() and flow: static(). WHATWG CSS Books has flow: area().

This module proposes a unified approach to paginated layout based on [CSS3-REGIONS] and [CSS3-PAGE-TEMPLATE]. Additional properties will be introduced as necessary.

1. Running headers and footers

[CSS3PAGE] describes the sixteen page margin boxes which can be used for running headers and footers, but does not describe a mechanism for inserting content in those boxes.

[CSS3GCPM] provides for copying the string values of elements into the existing page margin boxes.

The existing mechanisms do not cover many use cases.

1.1. Copying a flow: the copy-into property

Headers often contain document content, and it is desirable to both display that content normally (for example, as an h1) and to use the content in a running head. [CSS3-REGIONS] allows for an element to be moved to a named flow, but doesn’t allow for using the same content in two ways. The copy-into property allows an element to be copied into a content fragment which can then be placed with the content property.

Use cases for running heads can be found in [LATINREQ] http://w3c.github.io/dpub-pagination/#content

Name: copy-into
Value: none | [ [ <custom-ident> <content-level>] [, <custom-ident> <content-level>]* ]?
Initial: none
Applies to: all elements and pseudo-elements, but not ::first-line or ::first-letter.
Inherited: no
Percentages: n/a
Media: visual
Computed value: as specified
Canonical order: per grammar
Animation type: discrete

The copy-into property contains one or more pairs, each consisting of a custom identifier followed by a content-level keyword describing how to construct the value of the named content fragment.

content-level expands to the following values:

content-list = element | content | text | attr(<identifier>) | counter() | counters()
the entire element is copied into the named content fragment
only the element’s contents are copied into the named content fragment. This is the default if content-level is not specified.
only the element’s text (including normally collapsed white space) is copied into the named content fragment.
h1 {
  copy-into: chapter-title element;
  font-size: 1.5em;

@page {
  @top-center {
    content: chapter-title '.';
    font-size: .9em;
    font-variant: small-caps;

1.2. Choosing among multiple values on a page

1.2.1. Page selector pseudo-classes

By default, the content fragment name would be global, as the named flow is with flow-into. But if one of the following pseudo-classes are used on the subject of the selector, then the name is locally scoped to just the page the element is on.

The element is the nth matched element on the page.
Same as :nth-of-page(n), but where n = 1 (it is the first matched element on the page).
The element is the last matched element on the page.
The element is the first matched element on the page, and neither it nor its ancestors have any previous siblings that appear on the page.


<h1>The Voyage of the Beagle</h1>


h1::before {
  content: 'Chapter 'counter(chapterNumber);
h1:first-of-page {
  copy-into: headerP1 counter(chapter), headerP2;
h1::after {
  content: '.' copy-into: headerP3;

@top-center {
  content: headerP1 ": " headerP2 headerP3;

The value of the named string “headerP1” will be “Chapter 1”, and the value of the named string “headerP2” will be “Voyage of the Beagle”. headerP2 will include the italic tags around "Beagle", because the content-type defaults to contents, not text. The value of the named string “headerP3” will be “.”. The top-center content will be “Chapter 1: The Voyage of the Horizon.”

<section title="Loomings">


section:first-of-page { copy-into: header attr(title) }

The value of the “header” string will be “Loomings”, assuming that section intersected with the page.

@page {
   size: 15cm 10cm;
   margin: 1.5cm;

   @top-left {
   content: "first: " heading1;
   @top-center {
   content: "start: " heading2;
    @top-right {
    content: "last: " heading3;

h2:first-of-page { copy-into: heading1 }
h2:start-of-page { copy-into: heading2 }
h2:last-of-page { copy-into: heading3 }

The following figures show the first, start, and last assignments of the “heading” string on various pages.

The start value is empty, as the string had not yet been set at the start of the page.
Since the page starts with an h2, the start value is the value of that head.
Since there’s not an h2 at the top of this page, the start value is the exit value of the previous page.

2. Creating Page Areas

[CSS3-PAGE-TEMPLATE] introduces @template and @slot rules. We propose to allow the use of @slot in the @page context, to allow greater flexibility than the page margin boxes in [CSS3PAGE]. These slots can also be used for sidenotes, pull quotes, footnotes, and many other document features.

@page body {
  @slot center-header {
    top: 0px;
    left: 1em;
    right: 1em;
    height: 2em;
    flow-from: header;
    flow-persist: persist;
    wrap-flow: clear;

Is there a need for both @page and @template?

3. Footnotes

Ancillary content may be moved to the bottom or side of a page. A footnote is created when such content moves to the bottom of the page, leaving a reference indicator.

3.1. Terminology

Footnotes are complex objects, so it will be helpful to define some terms before proceeding.

page with footnotes

Footnote terminology
footnote element
The element containing the content of the footnote, which will be removed from the flow and displayed as a footnote.
footnote marker (also known as footnote number)
A number or symbol adjacent to the footnote body, identifying the particular footnote. The footnote marker should use the same number or symbol as the corresponding footnote call, although the marker may contain additional punctuation.
footnote body
The footnote marker is placed before the footnote element, and together they represent the footnote body, which will be placed in the footnote area.
footnote call (also known as footnote reference)
A number or symbol, found in the main text, which points to the footnote body.
footnote area
The page area used to display footnotes.
footnote rule (also known as footnote separator)
A horizontal rule is often used to separate the footnote area from the rest of the page. The separator (and the entire footnote area) cannot be rendered on a page with no footnotes.

3.2. Footnotes as Regions

<p>Though the body was erect, the head was thrown back so that the closed eyes were pointed towards the needle of the tell-tale that swung from a beam in the ceiling..<span class="reference"><span class="footnote">The cabin-compass is called the tell-tale, because without going to the compass at the helm, the Captain, while below, can inform himself of the course of the ship.</span></span></p>


span.footnote {
  flow-into: footnote;
  flow-policy: copy;
  display: block;

span.footnote::before {
  content: counter(footnote) '. ';

span.reference::before {
  content: counter(footnote);
  font-variant-position: super;

@page {
  @slot footnote {
    flow-from: footnote;
    required-flow: footnote;
    position: absolute;
    left: 54pt;
    bottom: 0pt;
    width: 352pt;
    height: auto;
    border-top: .25pt solid black;
    vertical-align: bottom;
    wrap-flow: clear;

The above HTML contains two nested spans for the footnote, as CSS has no mechanism to leave a reference object where something was removed from the flow.

Would it be possible to specify flow-into: none on span.footnote::after? [CSS3-REGIONS] forbids the flow-into property on pseudo-elements, but should that be changed?

Inline footnote
span.footnote {
  flow-into: footnote;
  display: inline;


Tab Atkins, Jr., Brak Kemper, Håkon Wium Lie, Liam Quin, Peter Sorotokin, Alan Stearns


Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <strong class="advisement">, like this: UAs MUST provide an accessible alternative.

Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
A CSS style sheet.
A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
A UA that writes a style sheet.

A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.

A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)

An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.

Requirements for Responsible Implementation of CSS

The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future.

Partial Implementations

So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported property values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.

Implementations of Unstable and Proprietary Features

To avoid clashes with future stable CSS features, the CSSWG recommends following best practices for the implementation of unstable features and proprietary extensions to CSS.

Implementations of CR-level Features

Once a specification reaches the Candidate Recommendation stage, implementers should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature.

To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.

Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.


Terms defined by this specification

Terms defined by reference


Normative References

Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 29 September 2016. CR. URL: https://www.w3.org/TR/css-values-3/
Rossen Atanassov; Alan Stearns. CSS Regions Module Level 1. 9 October 2014. WD. URL: http://dev.w3.org/csswg/css-regions/
Elika Etemad; Dave Cramer. CSS Generated Content Module Level 3. 2 June 2016. WD. URL: https://drafts.csswg.org/css-content/
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119

Informative References

Alan Stearns. CSS Pagination Templates Module Level 3. Proposal for a CSS module. URL: https://drafts.csswg.org/css3-page-template/
Dave Cramer. CSS Generated Content for Paged Media Module. 13 May 2014. WD. URL: http://dev.w3.org/csswg/css-gcpm/
Melinda Grant; et al. CSS Paged Media Module Level 3. 14 March 2013. WD. URL: https://www.w3.org/TR/css3-page/

Property Index

Name Value Initial Applies to Inh. %ages Media Anim­ation type Canonical order Com­puted value
copy-into none | [ [ <custom-ident> <content-level>] [, <custom-ident> <content-level>]* ]? none all elements and pseudo-elements, but not ::first-line or ::first-letter. no n/a visual discrete per grammar as specified

Issues Index

Is there a need for both @page and @template?
The above HTML contains two nested spans for the footnote, as CSS has no mechanism to leave a reference object where something was removed from the flow.
Would it be possible to specify flow-into: none on span.footnote::after? [CSS3-REGIONS] forbids the flow-into property on pseudo-elements, but should that be changed?