CSS Generated Content for Paged Media Module by Dave Cramer Abstract Books and other paged media often use special techniques to display information. Content may be moved to or generated for special areas of the page, such as running heads or footnotes. Generated content within pages, such as tab leaders or cross-references, helps readers navigate within and between pages. ^CSS][1] is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc. Table of Contents CSS Generated Content for Paged Media Module Table of Contents Status of this document Introduction Section 3 -- Selecting Pages Section 4 -- Leaders Section 5 -- Cross-references Section 6 -- Bookmarks Appendix A -- Where Are They Now? Appendix B -- Default UA Stylesheet Appendix C -- Changes Acknowledgments Conformance References Index Property Index Issues Index References Status of this document This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the ^W3C technical reports index][2] at http://www.w3.org/TR/. This draft updates the earlier draft of GCPM and, where content has been moved to other modules, an appendix indicates the current location of each. Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. The (^archived][3]) public mailing list ^www-style@w3.org][4] (see ^instructions][5]) is preferred for discussion of this specification. When sending e-mail, please put the text "css-gcpm" in the subject, preferably like this: "^css-gcpm] …summary of comment…" This document was produced by the ^CSS Working Group][6] (part of the ^Style Activity][7]). This document was produced by a group operating under the ^5 February 2004 W3C Patent Policy][8]. W3C maintains a ^public list of any patent disclosures][9] 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)][10] must disclose the information in accordance with ^section 6 of the W3C Patent Policy][11]. Introduction Paged media have many ^special requirements][12] for the display of document content, which have evolved over the long history of printed books. Running headers and footers function as aids to navigation. Notes may appear at the bottom of the page, as footnotes. The properties of pages themselves may change based on their content or position in the document. Leaders visually connect related content. Cross-references may require generated text. Some paged media formats such as PDF use bookmarks for navigation. This module defines new properties and values, so that authors may bring these techniques to paged media. ^^CSS3PAGE]][13] 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. This module provides two methods for for doing so. Named strings copy text for reuse in margin boxes. Running elements move elements (complete with style and structure) from the document to margin boxes. ### 1.1 Named strings The ^string-set][14] property copies the text content of an element into a ^named string][15], which functions as a variable. The text content of this named string can be retrieved using the ^string()][16] function. Since these variables may change on a given page, an optional second value for the ^string()][16] function allows authors to choose which value on a page is used. #### 1.1.1 The string-set property The ^string-set][14] property contains one or more pairs, each consisting of an custom identifier (the name of the named string) followed by a ^content-list][17] describing how to construct the value of the named string. ^content-list][17] expands to one or more of the following values, in any order. content-list = ^ | | | | attr() ]+ : A ^string][18], as defined in ^^CSS21]][19] : A ^counter()][20] function, as described in ^^CSS21]][19]. : A ^counters()][20] function, as described in ^^CSS21]][19]. content() : The ^content()][21] function, described below. attr() : Returns the string value of the attribute , as defined in ^^CSS3VAL]][22] content() = content(^text | before | after | first-letter ]) text : The string value of the element, determined as if `white-space: normal` had been set. This is the default value before : The string value of the `::before` pseudo-element, determined as if `white-space: normal` had been set. after : The string value of the `::after` pseudo-element, determined as if `white-space: normal` had been set. first-letter : The first letter of the element, as defined for the `^::first-letter][23]` pseudo-element The content values of named strings are assigned at the point when the content box of the element is first created (or would have been created if the element's display value is none). The entry value for a page is the assignment in effect at the end of the previous page. The exit value for a page is the assignment in effect at the end of the current page. Whenever the value of the element changes, the value of the named string(s) is updated. User agents must be able to recall many values of the named string, as the ^string()][16] function can return past, current, or future values of the assignment. HTML: Loomings CSS: h1::before { content: 'Chapter ' counter(chapter); } h1 { string-set: header content(before) ':' content(text); } h1::after { content: '.'; } The value of the named string "header" will be "Chapter 1: Loomings". HTML: CSS: section { string-set: header attr(title) } The value of the "header" string will be "Loomings". #### 1.1.2 The ^string()][16] function The ^string()][16] function is used to copy the value of a named string to the document, via the ^content][24] property. This function requires one argument, the name of the named string. Since the value of a named string may change several times on a page (as new instances of the element defining the string appear) an optional second argument indicates which value of the named string should be used. string() = string( ][25] ^ , ^ first | start | last | first-except] ]? ) The second argument of the ^string()][16] function is one of the following keywords: first : The value of the first assignment on the page is used. If there is no assignment on the page, the ^entry value][26] is used. `first` is the default value. start : If the element is the first element on the page, the value of the first assignment is used. Otherwise the ^entry value][26] is used. The ^entry value][26] may be empty if the element hasn't yet appeared. last : The ^exit value][27] of the named string is used. first-except : This is identical to `first`, except that the empty string is used on the page where the value is assigned. CSS: @page { size: 15cm 10cm; margin: 1.5cm; @top-left { content: "first: " string(heading, first); } @top-center { content: "start: " string(heading, start); } @top-right { content: "last: " string(heading, last); } } h2 { string-set: heading content() } The following figures show the first, start, and last assignments of the "heading" string on various pages. !^][28]The ^start][29] value is empty, as the string had not yet been set at the start of the page.!^][30]Since the page starts with an h2, the ^start][29] value is the value of that head.!^][31]Since there's not an h2 at the top of this page, the ^start][29] value is the ^exit value][27] of the previous page. ### 1.2 Running elements Many headers and footers cannot be represented only by unformatted text. A book title serving as a running head may contain an italic word, for example. A mechanism is needed to move or copy elements into margin boxes. To do this, we add the ^running()][32] value to the position property, and the ^element()][33] value to the content property. @page { @top { content: element(header); } } h1 { position: running(header); } In this example, the `h1` element is placed in the `@top` margin box, complete with formatting and any descendant elements. It does not display in the normal document flow. #### 1.2.1 The ^running()][32] value `position: running(custom-ident)` removes the element (and associated ::before and ::after pseudo-elements) from the normal flow, and makes it available to place in a page margin box using ^element()][33]. The element inherits from its original position in the document, but does not display there. Name: ^position][34] New values: running() Media: paged running() = string( ][25] ) HTML: Miranda v. Arizona in Context Miranda v. Arizona in Context CSS: @top-center { content: element(heading); } p.rh { position: running(heading); } p.rh::before { content: counter(page) ' / '; } !^running header using running elements][35] Running element in page margin box The element value() can only be used in page margin boxes. And it cannot be combined with other possible values for the content property. This idea would be much more useful if we could also copy (rather than just move) elements. That would avoid the duplication of HTML in the example above. Bert Bos has proposed an alternative syntax, which allows both moving and copying elements into running heads. In the example below, h2 elements appear in their normal place in the document, but are also copied into running heads. h2 { display: block; running: chapter; font-size: 18pt; font-weight: bold; } h2:running { display: inline; font-size: 11pt; font-weight: normal; font-variant: small-caps; letter-spacing: 1pt; } @page { @top-center { content: element(chapter); } } Name: running Value: ][25] Initial: none Applies to: elements Inherited: no Media: all Computed value: specified value Percentages: N/A #### 1.2.2 The ^element()][33] value The ^element()][33] value of the content property places an element (which has been removed from the normal flow via ^running()][32]) in a page margin box. Whenever the value of the element changes, the value of ^element()][33] is updated. Just as with ^string()][16], ^element()][33] takes an optional keyword to describe which value should be used in the case of multiple assignments on a page. User agents must be able to recall many values, as ^element()][33] can return past, current, or future values of the assignment. Name: ^content][24] New values: element() Media: paged element() = string( ][25] ^ , ^ first | start | last | first-except] ]? ) 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. Footnotes are complex objects (see the ^footnote section][36] at ^^dpub-latinreq]][37]), so it will be helpful to define some terms before proceeding. !^page with footnotes][38] 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. An element becomes a footnote by applying `float: footnote` to that element. This triggers the following actions: 1. The footnote element is removed from the flow, and a `::footnote-call` pseudo-element is inserted in its place, which serves as a reference to the footnote. 2. A `::footnote-marker` pseudo-element, identifying the footnote, is placed at the beginning of the footnote element. Together this is the footnote body. 3. The ^footnote counter][39] is incremented. 4. The footnote body is placed in the footnote area at the bottom of the page. Footnote elements from a given page are placed in the footnote area of that page in document order. HTML: 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.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. CSS: @page { @footnote { float: bottom; } } span.footnote { float: footnote; } Why is float:bottom used with the footnote area? Floating footnotes to the footnote area, and then floating the footnote area itself, seems overly complex, given that implementations don't allow the footnote area to float anywhere else. Note that some implementations do allow the footnote area to be absolutely positioned. The following new value of the ^float][40] property creates a footnote element: Name: ^float][40] New values: footnote Media: paged : each footnote element is placed in the footnote area of the page The ^footnote-display][41] property determines whether a footnote is displayed as a block element or inline element. Name: Value: block | inline | compact Initial: block Applies to: elements Inherited: no Media: paged Computed value: specified value Percentages: N/A : The footnote element is placed in the footnote area as a block element : The footnote element is placed in the footnote area as an inline element : The user agent determines whether a given footnote element is placed as a block element or an inline element. If two or more footnotes could fit on the same line in the footnote area, they should be placed inline. A ^page area][42] that can be used to display footnotes is described in the ^page context][43] using an `@footnote` rule. This rule defines a box that, if used, will contain all the footnote elements that appear on that page. How would one describe this in the grammar of CSS3-Page? The bottom margin edge of the footnote area is positioned so that it touches the bottom of the page area. The footnote area can only contain footnotes. How do footnotes work in multi-column text? Prince uses `float: prince-column-footnote` to create a footnote at the bottom of a column rather than the bottom of a page. Implementations that support footnotes generally support page floats like `float: bottom`. Page floats should end up above the footnote area. How might this be specified? The ^max-height][44] property on the footnote area limits the size of this area, unless the page contains only footnotes (as may happen on the last page of a document). Since it is undesirable for a page to consist only of footnotes, user agents may set a default max-height value on the footnote area. The is a predefined ^counter][45] associated with the footnote element. Its value is the number or symbol used to identify the footnote. This value is used in both the footnote call and the footnote marker. It should be incremented for each footnote. The footnote counter, like other counters, may use any ^counter style][46]. Footnotes often use a sequence of symbols. ::footnote-call { content: counter(footnote, symbols('*', '†', '‡', '§')); } ::footnote-marker { content: counter(footnote, symbols('*', '†', '‡', '§')) '. '; } The footnote counter may be reset on each page. @page { counter-reset: footnote; @footnote { … } } Note that the value of the footnote counter should depend on the position of the footnote element in the document tree, not where it is eventually placed. A footnote element may sometimes be placed on the page after the footnote call, but the same counter value must be used for both. A `::footnote-call` pseudo-element is inserted in place of the footnote element when the latter is removed from the flow. By default, the content of this pseudo-element is the value of the footnote counter, styled as a superscripted number. ::footnote-call { content: counter(footnote); vertical-align: baseline; font-size: 100%; line-height: inherit; font-variant-position: super; } The `::footnote-marker` pseudo-element represents the footnote element's marker, the number or symbol that identifies each footnote. This pseudo-element behaves like a `::marker` pseudo-element, as defined in ^^CSS3LIST]][47]. It is placed at the beginning of the superior parent's content, and is inline by default. The `::footnote-marker` can be styled just as other `::marker` elements can be. The default style should include `list-style-position: inside`. ::footnote-marker { content: counter(footnote); } ::footnote-marker::after { content: '. '; } Rendering footnotes can be complex. If a footnote falls near the bottom of the page, there may not be enough room on the page for the footnote body. The ^footnote-policy][48] property allows authors some influence over the rendering of difficult pages. Name: Value: auto | line | block Initial: auto Applies to: elements Inherited: no Media: paged Computed value: specified value Percentages: N/A auto : The user agent chooses how to render footnotes, and may place the footnote body on a later page than the footnote reference. A footnote body must never be placed on a page before the footnote reference. : If a given footnote body cannot be placed on the current page due to lack of space, the user agent introduces a forced page break at the start of the line containing the footnote reference, so that both the reference and the footnote body fall on the next page. Note that the user agent must honor ^widow and orphan][49] settings when doing this, and so may need to insert the page break on an earlier line. block : As with ^line][50], except a forced page break is introduced before the paragraph that contains the footnote. We need an algorithm for laying out footnotes ### 2.9 Future directions The next level will include sidenotes, column footnotes, and multiple footnote areas. Section 3 Selecting Pages A paginated document consists of a sequence of pages. ^^CSS3PAGE]] defines page selectors, which allow the selection of the first page of the document, left and right pages, and blank pages. Here we extend the idea of page selectors to enable the selection of arbitrary document pages. ### 3.1 Page Selectors The ^nth()][51] page pseudo-class allows the selection of arbitrary document pages. This pseudo-class takes an argument of the form ^An + B][52] as defined in ^^CSS3SYN]][53]. When applied to the default @page rule, ^nth()][51] selects the document page whose index matches the argument. nth() = ( An+B ^of ][25]]?) ^nth()][51] is not related to the page counter, which may reset and use various numbering schemes. When the ^nth()][51] selector is applied to a named page, and that named page is part of a page-group (see below), it selects the nth page in the page group. @page :nth(1) This selects the first page of the document. @page :nth(2n) This selects all even document pages. ### 3.2 Page groups Many paginated documents have a repeating structure, consisting of many chapters, sections, or articles. The first page of each subdivision often requires special treatment, but ^^CSS3PAGE]][13] doesn't define a way to select the first page of each chapter (as distinct from the first page of the entire document). When the ^page][54] property is applied to an element that also has a forced break property applied, a ^page group][55] is created. The page group is the collection of all pages created by an instance of that element. When a new instance of the element is rendered, a new ^page group][55] is started. A page may be part of several page groups, as a given ^page group][55] may have ancestors or descendants that are part of another ^page group][55]. CSS: div { page: A } child { page: B } !^][56]A page may be part of several page groups. Note that page 5 can be selected in three ways: @page :nth(5 of A) /* will select 5th page of every */ @page :nth(1 of B) /* will select first page of every */ @page :nth(5) /* will select 5th page of document */ Consider the following HTML: Chapter One some text ... ... Chapter Two some text ... ... ... And CSS: div.Chapter { page: body; } div.broadside { page: broadside; } In this case, each chapter will form a separate page group. @page:nth(3 of body) will select the third page of each chapter, even if that page happens to use the "broadside" named page. @page:nth(1) will select only the first page of the document, as will @page:first. Section 4 Leaders A leader, sometimes known as a tab leader or a dot leader, is a repeating pattern used to visually connect content across horizontal spaces. They are most commonly used in tables of contents, between titles and page numbers. The ^leader()][57] function, as a value for the content property, is used to create leaders in CSS. This function takes a string (the leader string), which describes the repeating pattern for the leader. Name: ^content][24] New values: leader() Media: paged leader() = leader( ^dotted | solid | space] | ][58]); Three keywords are shorthand values for common strings: dotted : leader('. ') solid : leader('_') space : leader(' ') : ol.toc a::after { content: leader('.') target-counter(attr(href url), page); } Table of Contents Loomings The Carpet-Bag The Spouter-Inn This might result in: Table of Contents 1. Loomings.....................1 2. The Carpet-Bag...............9 3. The Spouter-Inn.............13 Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)? ### 4.1 Rendering leaders Consider a line which contains the content before the leader (the "before content"), the leader, and the content after the leader (the "after content"). Leaders obey the following rules: 1. The leader string must appear in full at least once. 2. The leader should be as long as possible 3. Visible characters in leaders should vertically align with each other when possible. 4. Line break characters in the leader string must be ignored. 5. White space in the leader string follows normal CSS rules. 6. A leader only appears between the start content and the end content. 7. A leader only appears on a single line, even if the before content and after content are on different lines. 8. A leader can't be the only thing on a line. #### 4.1.1 Procedure for rendering leaders 1. Lay out the before content, until reaching the line where the before content ends. BBBBBBBBBB BBB 2. The leader string consists of one or more glyphs, and is thus an inline box. A leader is a row of these boxes, drawn from the end edge to the start edge, where only those boxes not overlaid by the before or after content. On this line, draw the leader string, starting from the end edge, repeating as many times as possible until reaching the start edge. BBBBBBBBBB .......... 3. Draw the before and after content on top of the leader. If any part of the before or after content overlaps a glyph in a leader string box, that glyph is not displayed. BBBBBBBBBB BBB....AAA 4. If one full copy of the leader string is not visible: BBBBBBB BBBBBBA Insert a line break before the after content, draw the leader on the next line, and draw the end content on top BBBBBBB BBBBBB ......A !^drawing leaders][59]Procedure for drawing leaders!^drawing leaders][60]Procedure for drawing leaders when the content doesn't fit on a single line Section 5 Cross-references Many documents contain internal references: * See chapter 7 * in section 4.1 * on page 23 Three new values for the content property are used to automatically create these types of cross-references: ^target-counter()][61], ^target-counters()][62], and ^target-text()][63]. Each of these displays information obtained from the target end of a link. ### 5.1 The ^target-counter()][61] function The ^target-counter()][61] function retrieves the value of the innermost counter with a given name. The required arguments are the url of the target and the name of the counter. An optional counter-style argument can be used to format the result. These functions only take a fragment URL which points to a location in the current document. If there's no fragment, if the ID referenced isn't there, or if the URL points to an outside document, the user agent must treat that as an error. target-counter() = target-counter( ][64] , ][25] ^ , ][65] ]? ) HTML: …which will be discussed on page 000. CSS: a::after { content: target-counter(attr(href url), page) } Result: …which will be discussed on page 137. Page numbers in tables of contents can be generated automatically: HTML: Preface Introduction Chapter One CSS: .frontmatter a::after { content: leader('.') target-counter(attr(href url), page, lower-roman) } .bodymatter a::after { content: leader('.') target-counter(attr(href url), page, decimal) } Result: Preface.............vii Introduction.........xi Chapter One...........1 ### 5.2 The ^target-counters()][62] function This functions fetches the value of all counters of a given name from the end of a link, and formats them by inserting a given string between the value of each nested counter. target-counters() = target-counter( ][64] , ][25] , ][58] ^ , ][65] ]? ) I have not found a compelling example for target-counters() yet. ### 5.3 target-text The ^target-text()][63] function retrieves the text value of the element referred to by the URL. An optional second argument specifies what content is retrieved, using the same values as the ^string-set][14] property above. target-text() = target-counter( ][64] ^ , ^ content | before | after | first-letter] ]? ) A simpler syntax has been proposed by fantasai: http://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html …which will be discussed later. a::after { content: ", in the chapter entitled " target-text(attr(href url)) } Result: …which will be discussed later, in the chapter entitled Loomings. Section 6 Bookmarks Some document formats, most notably PDF, allow the use of bookmarks as an aid to navigation. Bookmarks provide a hierarchy of links to document sections, as well as text to label the links. A bookmark has three properties: ^bookmark-level][66], ^bookmark-label][67], and ^bookmark-state][68]. ### 6.1 bookmark-level Name: bookmark-level Value: none | Initial: none Applies to: all elements Inherited: no Media: paged Computed value: specified value Percentages: N/A : defines the level of the bookmark, with the highest level being 1 (negative and zero values are invalid). none : no bookmark is generated. section h1 { bookmark-level: 1; } section section h1 { bookmark-level: 2; } section section section h1 { bookmark-level: 3; } ### 6.2 bookmark-label Name: bookmark-label Value: none Initial: none Applies to: all elements Inherited: no Media: paged Computed value: specified value Percentages: N/A : ][69] is defined above, in the section on the ^string-set][14] property. The value of ][69] becomes the text content of the bookmark label. none : no bookmark is generated. HTML: Loomings CSS: h1 { bookmark-label: content(text); bookmark-level: 1; } The bookmark label will be "Loomings". ### 6.3 bookmark-state Bookmarks typically toggle open and closed, with the open state displaying the next level of bookmarks. Name: bookmark-state Value: open | closed Initial: open Applies to: block-level elements Inherited: no Media: paged Computed value: specified value Percentages: N/A open : The bookmarks of the nearest descendants of an element with a bookmark-state of open will be displayed. closed : any bookmarks of descendant elements are not initially displayed. Appendix A Where Are They Now? Many sections which were in the ^29 November 2011 Working Draft][70] have been moved to other specifications. Here are some notes on where things have moved. ### Page marks and bleed area This section has been moved to ^CSS Paged Media Module Level 3][71]. ### CMYK colors This section has been moved to ^CSS Color Module Level 4][72]. ### Styling blank pages This section has been moved to ^CSS Paged Media Module Level 3][73] ### Paged presentations This section has been moved to ^CSS Overflow Module Level 3][74]. ### Navigation between pages This is discussed in ^WHATWG CSS Books][75]. ### Page floats This section has been moved to ^CSS Page Floats][76]. ### Selecting columns and pages A brief mention of selecting columns is found in ^WHATWG CSS Books][77]. Appendix B Default UA Stylesheet This appendix is informative, and is to help UA developers to implement a default stylesheet for HTML, but UA developers are free to ignore or modify as appropriate. @page { counter-reset: footnote; @footnote { counter-increment: footnote; float: bottom; column-span: all; height: auto; } } ::footnote-marker { content: counter(footnote); list-style-position: inside; } ::footnote-marker::after { content: '. '; } ::footnote-call { content: counter(footnote); vertical-align: super; font-size: 65%; } @supports ( font-variant-position: super ) { ::footnote-call { content: counter(footnote); vertical-align: baseline; font-size: 100%; line-height: inherit; font-variant-position: super; } } h1 { bookmark-level: 1 } h2 { bookmark-level: 2 } h3 { bookmark-level: 3 } h4 { bookmark-level: 4 } h5 { bookmark-level: 5 } h6 { bookmark-level: 6 } Appendix C Changes Changes since the ^24 September 2013 Editor's Draft][78] are: * The spec has a new editor. * All text and examples rewritten. * Added attr() value to ^string-set][14] property. This is supported by both Prince and AntennaHouse. * Added ^footnote-policy][48] property to control rendering of footnotes in difficult situations. * Added ^footnote-display][41] property to allow inline footnotes. * Removed sidenotes section. * Removed section on selecting elements within pages and columns * Removed page-group property, and added optional argument to nth() page pseudo-class to allow selection within page groups. In addition to the above changes, many other changes have been made since the ^29 November 2011 Working Draft][70]: * Page Marks and Bleeds section moved to ^CSS Paged Media Module Level 3][71] * CMYK Colors section moved to ^CSS Colors Level 4][72]. * Styling Blank Pages section deleted * Paged Presentations section moved to ^CSS Overflow Module Level 3][74]. * Navigation Between Pages moved to ^WHATWG CSS Books][75] * Page floats section moved to ^CSS Page Floats][76] * First-page pseudo-element section deleted * Selecting Columns and Pages section deleted * env() function removed from string-set property * alignment values of leaders removed * leader specified to occupy only a single line * content() value of target-text changed to content(text) * target-pull() value of content property removed Differences with the ^WHATWG CSS Books][79] specification: * Added attr() value to ^string-set][14] property. This is supported by both Prince and AntennaHouse. * ^CSS Books][79] does not have the ^footnote-display][80] property. * ^CSS Books][79] does not have the ^footnote-policy][81] property. * The relationship between the `nth()` page pseudo-class and the page-group concept is clarified, which may make the page-group property redundant. * This specification does not redefine the `:first` page pseudo-selector to select the first page of a page-group. * This specification does not consider: 1. Named areas 2. Selecting elements within pages 3. The `range()` page pseudo-class 4. Selecting columns 5. Baseline rhythms 6. Extending the box model 7. Character substitution 8. Microtypography Acknowledgments This work would not be possible without the immense contributions of Håkon Wium Lie. Chris Lilley, Elika J. Etemad, Alan Stearns, L. David Baron, Bert Bos, and Liam Quin have provided valuable feedback. Conformance ### 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]][82] 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. ### Conformance classes Conformance to this specification is defined for three conformance classes: style sheet : A ^CSS style sheet][83]. renderer : A ^UA][84] that interprets the semantics of a style sheet and renders documents that use them. authoring tool : A ^UA][84] 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. ### 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][85]) 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 component 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. ### Experimental implementations To avoid clashes with future CSS features, the CSS2.1 specification reserves a ^prefixed syntax][86] for proprietary and experimental extensions to CSS. Prior to a specification reaching the Candidate Recommendation stage in the W3C process, all implementations of a CSS feature are considered experimental. The CSS Working Group recommends that implementations use a vendor-prefixed syntax for such features, including those in W3C Working Drafts. This avoids incompatibilities with future changes in the draft. ### Non-experimental implementations Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec. 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 . Questions should be directed to the ^public-css-testsuite@w3.org][87] mailing list. References ### Normative References ### Informative References Index * auto, ^2.8][88] * block * value for footnote-display, ^2.3][89] * value for footnote-policy, ^2.8][90] * bookmark-label, ^6.2][91] * bookmark-level, ^6.1][92] * bookmarks, ^6][93] * bookmark-state, ^6.3][94] * compact, ^2.3][95] * content(), ^1.1.1.1][96] * content-list, ^1.1.1][97] * element(), ^1.2.2][98] * entry value, ^1.1.1.1][99] * exit value, ^1.1.1.1][100] * footnote, ^2.3][101] * footnote counter, ^2.5][102] * footnote-display, ^2.3][103] * footnote-policy, ^2.8][104] * inline, ^2.3][105] * leader(), ^4][106] * line, ^2.8][107] * named string, ^1][108] * nth(), ^3.1][109] * page group, ^3.2][110] * page selectors, ^3][111] * running(), ^1.2.1][112] * running, ^1.2.1][113] * Running elements, ^1][114] * string(), ^1.1.2][115] * string-set, ^1.1.1][116] * target-counter(), ^5.1][117] * target-counters(), ^5.2][118] * target-text(), ^5.3][119] Property Index NameValueInitialApplies toInh.%agesMediaComputed value string-set ^^ ] ^, ]* ] | none none all elements, but not pseudo-elements no N/A all specified value running none elements no N/A all specified value footnote-display block | inline | compact block elements no N/A paged specified value footnote-policy auto | line | block auto elements no N/A paged specified value bookmark-level none | none all elements no N/A paged specified value bookmark-label none none all elements no N/A paged specified value bookmark-state open | closed open block-level elements no N/A paged specified value Issues Index This idea would be much more useful if we could also copy (rather than just move) elements. That would avoid the duplication of HTML in the example above. Bert Bos has proposed an alternative syntax, which allows both moving and copying elements into running heads. In the example below, h2 elements appear in their normal place in the document, but are also copied into running heads. h2 { display: block; running: chapter; font-size: 18pt; font-weight: bold; } h2:running { display: inline; font-size: 11pt; font-weight: normal; font-variant: small-caps; letter-spacing: 1pt; } @page { @top-center { content: element(chapter); } } Name: running Value: ][25] Initial: none Applies to: elements Inherited: no Media: all Computed value: specified value Percentages: N/A ^ ? ][120] Why is float:bottom used with the footnote area? Floating footnotes to the footnote area, and then floating the footnote area itself, seems overly complex, given that implementations don't allow the footnote area to float anywhere else. Note that some implementations do allow the footnote area to be absolutely positioned.^ ? ][121] How would one describe this in the grammar of CSS3-Page?^ ? ][122] How do footnotes work in multi-column text? Prince uses `float: prince-column-footnote` to create a footnote at the bottom of a column rather than the bottom of a page.^ ? ][123] Implementations that support footnotes generally support page floats like `float: bottom`. Page floats should end up above the footnote area. How might this be specified?^ ? ][124] We need an algorithm for laying out footnotes^ ? ][125] Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)? ^ ? ][126] A simpler syntax has been proposed by fantasai: http://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html^ ? ][127] References [1] http://www.w3.org/TR/CSS/ [2] http://www.w3.org/TR/ [3] http://lists.w3.org/Archives/Public/www-style/ [4] mailto:www-style@w3.org?Subject=%5Bcss-gcpm%5D%20PUT%20SUBJECT%20HERE [5] http://www.w3.org/Mail/Request [6] http://www.w3.org/Style/CSS/members [7] http://www.w3.org/Style/ [8] http://www.w3.org/Consortium/Patent-Policy-20040205/ [9] http://www.w3.org/2004/01/pp-impl/32061/status [10] http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential [11] http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure [12] http://w3c.github.io/dpub-pagination/index.html [13] http://www.w3.org#css3page "css3page" [14] http://www.w3.org#propdef-string-set "string-set" [15] http://www.w3.org#named-strings0 "named string" [16] http://www.w3.org#funcdef-string "string()" [17] http://www.w3.org#content-list "content-list" [18] http://www.w3.org/TR/CSS21/syndata.html#strings [19] http://www.w3.org#css21 "css21" [20] http://www.w3.org/TR/CSS21/syndata.html#counter [21] http://www.w3.org#funcdef-content "content()" [22] http://www.w3.org#css3val "css3val" [23] http://www.w3.org/TR/css3-selectors/#first-letter [24] http://dev.w3.org/csswg/css-content-3/#content "content" [25] http://dev.w3.org/csswg/css-values-3/#identifier-value "" [26] http://www.w3.org#entry-value "entry value" [27] http://www.w3.org#exit-value "exit value" [28] http://zenmagiclove.com/misc/dauwhe/using-strings-1.jpg [29] http://www.w3.org#string-start [30] http://zenmagiclove.com/misc/dauwhe/using-strings-2.jpg [31] http://zenmagiclove.com/misc/dauwhe/using-strings-3.jpg [32] http://www.w3.org#funcdef-running "running()" [33] http://www.w3.org#funcdef-element "element()" [34] http://dev.w3.org/csswg/css-position-3/#position "position" [35] http://zenmagiclove.com/misc/dauwhe/running-element-gcpm_Page_1.jpg [36] http://www.w3.org/TR/2014/WD-dpub-latinreq-20140313/#footnotes [37] http://www.w3.org#dpub-latinreq "dpub-latinreq" [38] http://zenmagiclove.com/misc/dauwhe/footnote-diagram.001.jpg [39] http://www.w3.org#footnote-counter "footnote counter" [40] http://www.w3.org/TR/CSS21/visuren.html#propdef-float "float" [41] http://www.w3.org#propdef-footnote-display "footnote-display" [42] http://dev.w3.org/csswg/css-page/#page-area [43] http://dev.w3.org/csswg/css-page/#page-context [44] http://www.w3.org/TR/CSS21/visudet.html#propdef-max-height "max-height" [45] http://dev.w3.org/csswg/css-lists/#counter [46] http://dev.w3.org/csswg/css-counter-styles-3/#counter-style [47] http://www.w3.org#css3list "css3list" [48] http://www.w3.org#propdef-footnote-policy "footnote-policy" [49] http://dev.w3.org/csswg/css-break/#widows-orphans [50] http://www.w3.org#footnote-policy-line [51] http://www.w3.org#funcdef-nth "nth()" [52] http://dev.w3.org/csswg/css-syntax/#anb [53] http://www.w3.org#css3syn "css3syn" [54] http://dev.w3.org/csswg/css-page-3/#propdef-page "page" [55] http://www.w3.org#page-group "page group" [56] http://zenmagiclove.com/misc/dauwhe/PageGroups.001.jpg [57] http://www.w3.org#funcdef-leader "leader()" [58] http://dev.w3.org/csswg/css-values-3/#string-value "" [59] http://zenmagiclove.com/misc/dauwhe/leader.001.jpg [60] http://zenmagiclove.com/misc/dauwhe/leader.002.jpg [61] http://www.w3.org#funcdef-target-counter "target-counter()" [62] http://www.w3.org#funcdef-target-counters "target-counters()" [63] http://www.w3.org#target-text-function "target-text()" [64] http://dev.w3.org/csswg/css-values-3/#url-value "" [65] http://dev.w3.org/csswg/css-counter-styles-3/#typedef-counter-style "" [66] http://www.w3.org#propdef-bookmark-level "bookmark-level" [67] http://www.w3.org#propdef-bookmark-label "bookmark-label" [68] http://www.w3.org#propdef-bookmark-state "bookmark-state" [69] http://www.w3.org#content-list [70] http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/ [71] http://dev.w3.org/csswg/css-page/#marks [72] http://dev.w3.org/csswg/css-color/#cmyk-colors [73] http://dev.w3.org/csswg/css-page/#blank-pseudo [74] http://dev.w3.org/csswg/css-overflow-3/#paginated-overflow [75] http://books.spec.whatwg.org/#spatial-layout-of-pages;-@layout [76] http://dev.w3.org/csswg/css-page-floats/ [77] http://books.spec.whatwg.org/#selecting-columns [78] https://dvcs.w3.org/hg/csswg/raw-file/6a5c44d11c2b/css-gcpm/Overview.html [79] http://books.spec.whatwg.org/ [80] http://www.w3.org#propdef-footnote-display [81] http://www.w3.org#footnote-policy [82] http://www.w3.org#rfc2119 "rfc2119" [83] http://www.w3.org/TR/CSS21/conform.html#style-sheet [84] http://www.w3.org/TR/CSS21/conform.html#user-agent [85] http://www.w3.org/TR/CSS21/conform.html#ignore [86] http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords [87] http://lists.w3.org/Archives/Public/public-css-testsuite [88] http://www.w3.org#valuedef-auto "section 2.8" [89] http://www.w3.org#footnote-display-block "section 2.3" [90] http://www.w3.org#valuedef-block "section 2.8" [91] http://www.w3.org#propdef-bookmark-label "section 6.2" [92] http://www.w3.org#propdef-bookmark-level "section 6.1" [93] http://www.w3.org#bookmarks0 "section 6" [94] http://www.w3.org#propdef-bookmark-state "section 6.3" [95] http://www.w3.org#footnote-display-compact "section 2.3" [96] http://www.w3.org#funcdef-content "section 1.1.1.1" [97] http://www.w3.org#content-list "section 1.1.1" [98] http://www.w3.org#funcdef-element "section 1.2.2" [99] http://www.w3.org#entry-value "section 1.1.1.1" [100] http://www.w3.org#exit-value "section 1.1.1.1" [101] http://www.w3.org#valuedef-footnote "section 2.3" [102] http://www.w3.org#footnote-counter "section 2.5" [103] http://www.w3.org#propdef-footnote-display "section 2.3" [104] http://www.w3.org#propdef-footnote-policy "section 2.8" [105] http://www.w3.org#footnote-display-inline "section 2.3" [106] http://www.w3.org#funcdef-leader "section 4" [107] http://www.w3.org#footnote-policy-line "section 2.8" [108] http://www.w3.org#named-strings0 "section 1" [109] http://www.w3.org#funcdef-nth "section 3.1" [110] http://www.w3.org#page-group "section 3.2" [111] http://www.w3.org#page-selectors "section 3" [112] http://www.w3.org#funcdef-running "section 1.2.1" [113] http://www.w3.org#propdef-running "section 1.2.1" [114] http://www.w3.org#running-elements0 "section 1" [115] http://www.w3.org#funcdef-string "section 1.1.2" [116] http://www.w3.org#propdef-string-set "section 1.1.1" [117] http://www.w3.org#funcdef-target-counter "section 5.1" [118] http://www.w3.org#funcdef-target-counters "section 5.2" [119] http://www.w3.org#target-text-function "section 5.3" [120] http://www.w3.org#issue-11bb4305 [121] http://www.w3.org#issue-4af1f674 [122] http://www.w3.org#issue-829ce977 [123] http://www.w3.org#issue-ab22b570 [124] http://www.w3.org#issue-165f8769 [125] http://www.w3.org#issue-da883bb8 [126] http://www.w3.org#issue-2f5c8d3f [127] http://www.w3.org#issue-a82075c9 [Source](http://www.w3.org/TR/css3-gcpm/ "Permalink to CSS Generated Content for Paged Media Module")