CINXE.COM

CSS Generated Content for Paged Media Module

<!doctype html><html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <title>CSS Generated Content for Paged Media Module</title> <meta content="WD" name="w3c-status"> <meta content="Bikeshed version 742f3d674, updated Mon Nov 4 14:56:54 2024 -0800" name="generator"> <link href="https://www.w3.org/TR/css-gcpm-3/" rel="canonical"> <meta content="634ecfb8988b4f0dfab0ada6947af660bd6cbe33" name="revision"> <meta content="dark light" name="color-scheme"> <style>/* Boilerplate: style-autolinks */ .css.css, .property.property, .descriptor.descriptor { color: var(--a-normal-text); font-size: inherit; font-family: inherit; } .css::before, .property::before, .descriptor::before { content: "‘"; } .css::after, .property::after, .descriptor::after { content: "’"; } .property, .descriptor { /* Don't wrap property and descriptor names */ white-space: nowrap; } .type { /* CSS value <type> */ font-style: italic; } pre .property::before, pre .property::after { content: ""; } [data-link-type="property"]::before, [data-link-type="propdesc"]::before, [data-link-type="descriptor"]::before, [data-link-type="value"]::before, [data-link-type="function"]::before, [data-link-type="at-rule"]::before, [data-link-type="selector"]::before, [data-link-type="maybe"]::before { content: "‘"; } [data-link-type="property"]::after, [data-link-type="propdesc"]::after, [data-link-type="descriptor"]::after, [data-link-type="value"]::after, [data-link-type="function"]::after, [data-link-type="at-rule"]::after, [data-link-type="selector"]::after, [data-link-type="maybe"]::after { content: "’"; } [data-link-type].production::before, [data-link-type].production::after, .prod [data-link-type]::before, .prod [data-link-type]::after { content: ""; } [data-link-type=element], [data-link-type=element-attr] { font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: .9em; } [data-link-type=element]::before { content: "<" } [data-link-type=element]::after { content: ">" } [data-link-type=biblio] { white-space: pre; } @media (prefers-color-scheme: dark) { :root { --selflink-text: black; --selflink-bg: silver; --selflink-hover-text: white; } } </style> <style>/* Boilerplate: style-colors */ /* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */ :root { color-scheme: light dark; --text: black; --bg: white; --unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #707070; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #f8f8f8; --tocnav-active-text: #c00; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #f7f8f9; --tocsidebar-shadow: rgba(0,0,0,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #3980b5; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #005a9c; --hr-text: var(--text); --algo-border: #def; --del-text: red; --del-bg: transparent; --ins-text: #080; --ins-bg: transparent; --a-normal-text: #034575; --a-normal-underline: #bbb; --a-visited-text: var(--a-normal-text); --a-visited-underline: #707070; --a-hover-bg: rgba(75%, 75%, 75%, .25); --a-active-text: #c00; --a-active-underline: #c00; --blockquote-border: silver; --blockquote-bg: transparent; --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: #fbe9e9; --issue-text: var(--text); --issueheading-text: #831616; --example-border: #e0cb52; --example-bg: #fcfaee; --example-text: var(--text); --exampleheading-text: #574b0f; --note-border: #52e052; --note-bg: #e9fbe9; --note-text: var(--text); --noteheading-text: hsl(120, 70%, 30%); --notesummary-underline: silver; --assertion-border: #aaa; --assertion-bg: #eee; --assertion-text: black; --advisement-border: orange; --advisement-bg: #fec; --advisement-text: var(--text); --advisementheading-text: #b35f00; --warning-border: red; --warning-bg: hsla(40,100%,50%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #F5F0FF; --amendment-text: var(--text); --amendmentheading-text: #220066; --def-border: #8ccbf2; --def-bg: #def; --def-text: var(--text); --defrow-border: #bbd7e9; --datacell-border: silver; --indexinfo-text: #707070; --indextable-hover-text: black; --indextable-hover-bg: #f7f8f9; --outdatedspec-bg: rgba(0, 0, 0, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } @media (prefers-color-scheme: dark) { :root { --text: #ddd; --bg: black; --unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E"); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #999; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #080808; --tocnav-active-text: #f44; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #080808; --tocsidebar-shadow: rgba(255,255,255,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #6af; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #8af; --hr-text: var(--text); --algo-border: #456; --del-text: #f44; --del-bg: transparent; --ins-text: #4a4; --ins-bg: transparent; --a-normal-text: #6af; --a-normal-underline: #555; --a-visited-text: var(--a-normal-text); --a-visited-underline: var(--a-normal-underline); --a-hover-bg: rgba(25%, 25%, 25%, .2); --a-active-text: #f44; --a-active-underline: var(--a-active-text); --borderedblock-bg: rgba(255, 255, 255, .05); --blockquote-border: silver; --blockquote-bg: var(--borderedblock-bg); --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: var(--borderedblock-bg); --issue-text: var(--text); --issueheading-text: hsl(0deg, 70%, 70%); --example-border: hsl(50deg, 90%, 60%); --example-bg: var(--borderedblock-bg); --example-text: var(--text); --exampleheading-text: hsl(50deg, 70%, 70%); --note-border: hsl(120deg, 100%, 35%); --note-bg: var(--borderedblock-bg); --note-text: var(--text); --noteheading-text: hsl(120, 70%, 70%); --notesummary-underline: silver; --assertion-border: #444; --assertion-bg: var(--borderedblock-bg); --assertion-text: var(--text); --advisement-border: orange; --advisement-bg: #222218; --advisement-text: var(--text); --advisementheading-text: #f84; --warning-border: red; --warning-bg: hsla(40,100%,20%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #080010; --amendment-text: var(--text); --amendmentheading-text: #cc00ff; --def-border: #8ccbf2; --def-bg: #080818; --def-text: var(--text); --defrow-border: #136; --datacell-border: silver; --indexinfo-text: #aaa; --indextable-hover-text: var(--text); --indextable-hover-bg: #181818; --outdatedspec-bg: rgba(255, 255, 255, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } /* In case a transparent-bg image doesn't expect to be on a dark bg, which is quite common in practice... */ img { background: white; } } </style> <style>/* Boilerplate: style-counters */ body { counter-reset: example figure issue; } .issue { counter-increment: issue; } .issue:not(.no-marker)::before { content: "Issue " counter(issue); } .example { counter-increment: example; } .example:not(.no-marker)::before { content: "Example " counter(example); } .invalid.example:not(.no-marker)::before, .illegal.example:not(.no-marker)::before { content: "Invalid Example" counter(example); } figcaption { counter-increment: figure; } figcaption:not(.no-marker)::before { content: "Figure " counter(figure) " "; } </style> <style>/* Boilerplate: style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #ffc; --dfnpanel-target-outline: orange; } @media (prefers-color-scheme: dark) { :root { --dfnpanel-bg: #222; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #333; --dfnpanel-target-outline: silver; } } .dfn-panel { position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel a:focus { outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0 0 0 1em; list-style: none; } .dfn-panel li a { max-width: calc(300px - 1.5em - 1em); overflow: hidden; text-overflow: ellipsis; } .dfn-panel.activated { display: inline-block; position: fixed; left: 8px; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; transition: left 1s ease-out, bottom 1s ease-out; } .dfn-panel .link-item:hover { text-decoration: underline; } .dfn-panel .link-item .copy-icon { opacity: 0; } .dfn-panel .link-item:hover .copy-icon, .dfn-panel .link-item .copy-icon:focus { opacity: 1; } .dfn-panel .copy-icon { display: inline-block; margin-right: 0.5em; width: 0.85em; height: 1em; border-radius: 3px; background-color: #ccc; cursor: pointer; } .dfn-panel .copy-icon .icon { width: 100%; height: 100%; background-color: #fff; display: flex; justify-content: center; align-items: center; position: relative; } .dfn-panel .copy-icon .icon::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 1px solid black; background-color: #ccc; opacity: 0.25; transform: translate(3px, -3px); } .dfn-panel .copy-icon:active .icon::before { opacity: 1; } .dfn-paneled[role="button"] { cursor: help; } .highlighted { animation: target-fade 3s; } @keyframes target-fade { from { background-color: var(--dfnpanel-target-bg); outline: 5px solid var(--dfnpanel-target-outline); } to { color: var(--a-normal-text); background-color: transparent; outline: transparent; } } </style> <style>/* Boilerplate: style-issues */ a[href].issue-return { float: right; float: inline-end; color: var(--issueheading-text); font-weight: bold; text-decoration: none; } </style> <style>/* Boilerplate: style-md-lists */ /* This is a weird hack for me not yet following the commonmark spec regarding paragraph and lists. */ [data-md] > :first-child { margin-top: 0; } [data-md] > :last-child { margin-bottom: 0; } </style> <style>/* Boilerplate: style-ref-hints */ :root { --ref-hint-bg: #ddd; --ref-hint-text: var(--text); } @media (prefers-color-scheme: dark) { :root { --ref-hint-bg: #222; --ref-hint-text: var(--text); } } .ref-hint { display: inline-block; position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.5em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--ref-hint-bg); color: var(--ref-hint-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .ref-hint * { margin: 0; padding: 0; text-indent: 0; } .ref-hint ul { padding: 0 0 0 1em; list-style: none; } </style> <style>/* Boilerplate: style-selflinks */ :root { --selflink-text: white; --selflink-bg: gray; --selflink-hover-text: black; } .heading, .issue, .note, .example, li, dt { position: relative; } a.self-link { position: absolute; top: 0; left: calc(-1 * (3.5rem - 26px)); width: calc(3.5rem - 26px); height: 2em; text-align: center; border: none; transition: opacity .2s; opacity: .5; } a.self-link:hover { opacity: 1; } .heading > a.self-link { font-size: 83%; } .example > a.self-link, .note > a.self-link, .issue > a.self-link { /* These blocks are overflow:auto, so positioning outside doesn't work. */ left: auto; right: 0; } li > a.self-link { left: calc(-1 * (3.5rem - 26px) - 2em); } dfn > a.self-link { top: auto; left: auto; opacity: 0; width: 1.5em; height: 1.5em; background: var(--selflink-bg); color: var(--selflink-text); font-style: normal; transition: opacity .2s, background-color .2s, color .2s; } dfn:hover > a.self-link { opacity: 1; } dfn > a.self-link:hover { color: var(--selflink-hover-text); } a.self-link::before { content: "¶"; } .heading > a.self-link::before { content: "§"; } dfn > a.self-link::before { content: "#"; } </style> <link href="https://www.w3.org/StyleSheets/TR/2021/W3C-WD" rel="stylesheet"> <link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css"> <body class="h-entry"> <div class="head"> <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p> <h1 class="p-name no-ref" id="title">CSS Generated Content for Paged Media Module</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types/#WD">W3C Working Draft</a>, <time class="dt-updated" datetime="2024-05-04">4 May 2024</time></p> <details open> <summary>More details about this document</summary> <div data-fill-with="spec-metadata"> <dl> <dt>This version: <dd><a class="u-url" href="https://www.w3.org/TR/2024/WD-css-gcpm-3-20240504/">https://www.w3.org/TR/2024/WD-css-gcpm-3-20240504/</a> <dt>Latest published version: <dd><a href="https://www.w3.org/TR/css-gcpm-3/">https://www.w3.org/TR/css-gcpm-3/</a> <dt>Editor's Draft: <dd><a href="https://drafts.csswg.org/css-gcpm/">https://drafts.csswg.org/css-gcpm/</a> <dt>History: <dd><a class="u-url" href="https://www.w3.org/standards/history/css-gcpm-3/">https://www.w3.org/standards/history/css-gcpm-3/</a> <dt>Feedback: <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-gcpm-3">CSSWG Issues Repository</a> <dd><a href="#issues-index">Inline In Spec</a> <dt class="editor">Editors: <dd class="editor p-author h-card vcard" data-editor-id="118053"><a class="p-name fn u-email email" href="mailto:mike@bfo.com">Mike Bremford</a> (<span class="p-org org">BFO</span>) <dd class="editor p-author h-card vcard" data-editor-id="81117"><a class="p-name fn u-email email" href="mailto:rachelandrew@google.com">Rachel Andrew</a> (<span class="p-org org">Google</span>) <dt class="editor">Former Editors: <dd class="editor p-author h-card vcard" data-editor-id="65283"><a class="p-name fn u-email email" href="mailto:dave.cramer@hbgusa.com">Dave Cramer</a> (<span class="p-org org">Hachette Livre</span>) <dd class="editor p-author h-card vcard"><span class="p-name fn">Håkon Wium Lie</span> (<span class="p-org org">Opera Software</span>) <dt>Suggest an Edit for this Spec: <dd><a href="https://github.com/w3c/csswg-drafts/blob/main/css-gcpm-3/Overview.bs">GitHub Editor</a> </dl> </div> </details> <div data-fill-with="warning"></div> <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/copyright/software-license/" rel="license" title="W3C Software and Document License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p>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.</p> <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc. <script> const githubPrefix = "https://w3c.github.io/csswg-drafts/"; if(location.href.slice(0, githubPrefix.length) == githubPrefix) { const suffix = location.href.slice(githubPrefix.length); const draftUrl = "https://drafts.csswg.org/" + suffix; window.location.replace(draftUrl); } </script> </div> <h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2> <div data-fill-with="status"> <p><em>This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/">W3C technical reports index at https://www.w3.org/TR/.</a></em> </p> <p> This document was published by the <a href="https://www.w3.org/groups/wg/css">CSS Working Group</a> as a <strong>Working Draft</strong> using the <a href="https://www.w3.org/policies/process/20231103/#recs-and-notes">Recommendation track</a>. Publication as a Working Draft does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. </p> <p> 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. </p> <p>Please send feedback by <a href="https://github.com/w3c/csswg-drafts/issues">filing issues in GitHub</a> (preferred), including the spec code “css-gcpm” in the title, like this: “[css-gcpm] <i>…summary of comment…</i>”. All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>. Alternately, feedback can be sent to the (<a href="https://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bcss-gcpm%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a>. </p> <p>This document is governed by the <a href="https://www.w3.org/policies/process/20231103/" id="w3c_process_revision">03 November 2023 W3C Process Document</a>. </p> <p>This document was produced by a group operating under the <a href="https://www.w3.org/policies/patent-policy/20200915/">W3C Patent Policy</a>. W3C maintains a <a href="https://www.w3.org/groups/wg/css/ipr" rel="disclosure">public list of any patent disclosures</a> 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 <a href="https://www.w3.org/policies/patent-policy/20200915/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/policies/patent-policy/20200915/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p> <p></p> </div> <div data-fill-with="at-risk"></div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li> <a href="#introduction"><span class="secno"></span> <span class="content"> Introduction </span></a> <ol class="toc"> <li><a href="#values"><span class="secno"></span> <span class="content"> Value Definitions</span></a> </ol> <li> <a href="#running-headers-and-footers"><span class="secno">1</span> <span class="content"> Running headers and footers </span></a> <ol class="toc"> <li> <a href="#named-strings"><span class="secno">1.1</span> <span class="content"> Named strings </span></a> <ol class="toc"> <li> <a href="#setting-named-strings-the-string-set-pro"><span class="secno">1.1.1</span> <span class="content"> The string-set property </span></a> <ol class="toc"> <li><a href="#content-function-header"><span class="secno">1.1.1.1</span> <span class="content">The <span class="css">content()</span> function</span></a> </ol> <li><a href="#using-named-strings"><span class="secno">1.1.2</span> <span class="content"> The <span class="css">string()</span> function </span></a> </ol> <li> <a href="#running-elements"><span class="secno">1.2</span> <span class="content"> Running elements </span></a> <ol class="toc"> <li><a href="#running-syntax"><span class="secno">1.2.1</span> <span class="content"> The <span class="css">running()</span> value </span></a> <li><a href="#element-syntax"><span class="secno">1.2.2</span> <span class="content"> The <span class="css">element()</span> value </span></a> </ol> </ol> <li> <a href="#footnotes"><span class="secno">2</span> <span class="content"> Footnotes </span></a> <ol class="toc"> <li><a href="#footnote-terms"><span class="secno">2.1</span> <span class="content">Terminology</span></a> <li><a href="#creating-footnotes"><span class="secno">2.2</span> <span class="content"> Creating footnotes </span></a> <li><a href="#footnote-types"><span class="secno">2.3</span> <span class="content"> Types of footnotes </span></a> <li> <a href="#footnote-area"><span class="secno">2.4</span> <span class="content"> The footnote area </span></a> <ol class="toc"> <li><a href="#footnote-area-position"><span class="secno">2.4.1</span> <span class="content">Positioning of the footnote area</span></a> <li><a href="#footnote-area-size"><span class="secno">2.4.2</span> <span class="content">Size of the footnote area</span></a> </ol> <li> <a href="#footnote-counters"><span class="secno">2.5</span> <span class="content">The Footnote Counter</span></a> <ol class="toc"> <li><a href="#footnote-counter-values"><span class="secno">2.5.1</span> <span class="content">Values of the footnote counter</span></a> <li><a href="#resetting-footnote-counter"><span class="secno">2.5.2</span> <span class="content">Resetting the footnote counter</span></a> </ol> <li><a href="#footnote-call"><span class="secno">2.6</span> <span class="content"> The <code>footnote-call</code> pseudo-element </span></a> <li><a href="#footnote-marker"><span class="secno">2.7</span> <span class="content"> The <code>footnote-marker</code> pseudo-element </span></a> <li><a href="#footnote-policy"><span class="secno">2.8</span> <span class="content"> Rendering footnotes and <code>footnote policy</code> </span></a> <li><a href="#future"><span class="secno">2.9</span> <span class="content"> Future directions </span></a> </ol> <li> <a href="#the-first-page-pseudo-element"><span class="secno">3</span> <span class="content"> Selecting Pages </span></a> <ol class="toc"> <li><a href="#document-page-selectors"><span class="secno">3.1</span> <span class="content"> Page Selectors </span></a> <li><a href="#document-sequence-selectors"><span class="secno">3.2</span> <span class="content"> Page groups </span></a> </ol> <li><a href="#leaders"><span class="secno">4</span> <span class="content"> Leaders (moved) </span></a> <li><a href="#cross-references"><span class="secno">5</span> <span class="content"> Cross-references (moved) </span></a> <li><a href="#bookmarks"><span class="secno">6</span> <span class="content"> Bookmarks (moved) </span></a> <li> <a href="#former-wd-sections"><span class="secno"></span> <span class="content">Appendix A: Where Are They Now?</span></a> <ol class="toc"> <li><a href="#page-marks-and-bleed-area"><span class="secno"></span> <span class="content">Page marks and bleed area</span></a> <li><a href="#cmyk-colors"><span class="secno"></span> <span class="content">CMYK colors</span></a> <li><a href="#styling-blank-pages"><span class="secno"></span> <span class="content">Styling blank pages</span></a> <li><a href="#paged-presentations"><span class="secno"></span> <span class="content">Paged presentations</span></a> <li><a href="#navigation-between-pages"><span class="secno"></span> <span class="content">Navigation between pages</span></a> <li><a href="#page-floats"><span class="secno"></span> <span class="content">Page floats</span></a> <li><a href="#selecting-columns-and-pages"><span class="secno"></span> <span class="content">Selecting columns and pages</span></a> </ol> <li><a href="#ua-stylesheet"><span class="secno"></span> <span class="content">Appendix B: Default UA Stylesheet</span></a> <li><a href="#changes"><span class="secno"></span> <span class="content">Appendix C: Changes</span></a> <li><a href="#privacy"><span class="secno"></span> <span class="content">Privacy Considerations</span></a> <li><a href="#security"><span class="secno"></span> <span class="content">Security Considerations</span></a> <li><a href="#acknowledgments"><span class="secno"></span> <span class="content"> Acknowledgments </span></a> <li> <a href="#w3c-conformance"><span class="secno"></span> <span class="content"> Conformance</span></a> <ol class="toc"> <li><a href="#w3c-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a> <li><a href="#w3c-conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a> <li> <a href="#w3c-partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a> <ol class="toc"> <li><a href="#w3c-conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a> </ol> <li><a href="#w3c-testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a> </ol> <li> <a href="#index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> <li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a> <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a> </ol> </nav> <main> <h2 class="no-num heading settled" id="introduction"><span class="content"> Introduction </span></h2> <p>Paged media have many <a href="http://w3c.github.io/dpub-pagination/index.html">special requirements</a> 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.</p> <p>This module defines new properties and values, so that authors may bring these techniques to paged media.</p> <h3 class="heading settled" id="values"><span class="content"> Value Definitions</span></h3> <p>This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from <a data-link-type="biblio" href="#biblio-css21" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS21]</a> using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from <a data-link-type="biblio" href="#biblio-css-values-3" title="CSS Values and Units Module Level 3">[CSS-VALUES-3]</a>. Value types not defined in this specification are defined in CSS Values &amp; Units <span title="CSS Values and Units Module Level 3">[CSS-VALUES-3]</span>. Combination with other CSS modules may expand the definitions of these value types.</p> <p>In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#css-wide-keywords" id="ref-for-css-wide-keywords">CSS-wide keywords</a> as their property value. For readability they have not been repeated explicitly.</p> <h2 class="heading settled" data-level="1" id="running-headers-and-footers"><span class="secno">1. </span><span class="content"> Running headers and footers </span><a class="self-link" href="#running-headers-and-footers"></a></h2> <a data-link-type="biblio" href="#biblio-css3page" title="CSS Paged Media Module Level 3">[CSS3PAGE]</a> 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 doing so. <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="named string" data-noexport id="named-string">Named strings</dfn> copy text for reuse in margin boxes. <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="running-elements0">Running elements</dfn> move elements (complete with style and structure) from the document to margin boxes. <h3 class="heading settled" data-level="1.1" id="named-strings"><span class="secno">1.1. </span><span class="content"> Named strings </span><a class="self-link" href="#named-strings"></a></h3> The <a class="property css" data-link-type="property" href="#propdef-string-set" id="ref-for-propdef-string-set">string-set</a> property copies the text content of an element into a <span class="css">named string</span>, which functions as a variable. The text content of this named string can be retrieved using the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-content-3/#funcdef-string" id="ref-for-funcdef-string">string()</a> function. Since these variables may change on a given page, an optional second value for the <span class="css" id="ref-for-funcdef-string①">string()</span> function allows authors to choose which value on a page is used. <h4 class="heading settled" data-level="1.1.1" id="setting-named-strings-the-string-set-pro"><span class="secno">1.1.1. </span><span class="content"> The string-set property </span><a class="self-link" href="#setting-named-strings-the-string-set-pro"></a></h4> <table class="def propdef" data-link-for-hint="string-set"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-string-set">string-set</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod">[ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value">&lt;custom-ident></a> <a class="production css" data-link-type="type" href="#content-list" id="ref-for-content-list">&lt;content-list></a> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma">#</a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one">|</a> none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>all elements, but not pseudo-elements <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified value <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <p class="all-media">User agents are expected to support this property on all media, including non-visual ones.</p> <p>The <a class="property css" data-link-type="property" href="#propdef-string-set" id="ref-for-propdef-string-set①">string-set</a> property contains one or more pairs, each consisting of an custom identifier (the name of the named string) followed by a <a class="production css" data-link-type="type" href="#content-list" id="ref-for-content-list①">&lt;content-list></a> describing how to construct the value of the named string.</p> <p><a class="production css" data-link-type="type" href="#content-list" id="ref-for-content-list②">&lt;content-list></a> expands to one or more of the following values, in any order.</p> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="content-list">&lt;content-list></dfn> = [ <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value">&lt;string></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> <a class="production" data-link-type="function" href="https://www.w3.org/TR/css-lists-3/#funcdef-counter" id="ref-for-funcdef-counter">&lt;counter()></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②">|</a> <a class="production" data-link-type="function" href="https://www.w3.org/TR/css-lists-3/#funcdef-counters" id="ref-for-funcdef-counters">&lt;counters()></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③">|</a> <a class="production" data-link-type="function" href="#funcdef-content" id="ref-for-funcdef-content">&lt;content()></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one④">|</a> <a class="production" data-link-type="function" href="https://www.w3.org/TR/css-values-5/#funcdef-attr" id="ref-for-funcdef-attr">&lt;attr()></a> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus">+</a> </pre> <dl> <dt><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value①">&lt;string></a> <dd>A <a href="https://www.w3.org/TR/CSS21/syndata.html#strings">string</a>, as defined in <a data-link-type="biblio" href="#biblio-css21" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS21]</a> <dt><a class="production css" data-link-type="function" href="https://www.w3.org/TR/css-lists-3/#funcdef-counter" id="ref-for-funcdef-counter①">&lt;counter()></a> <dd>A <a href="https://www.w3.org/TR/CSS21/syndata.html#counter">counter()</a> function, as described in <a data-link-type="biblio" href="#biblio-css21" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS21]</a>. <dt><a class="production css" data-link-type="function" href="https://www.w3.org/TR/css-lists-3/#funcdef-counters" id="ref-for-funcdef-counters①">&lt;counters()></a> <dd>A <a href="https://www.w3.org/TR/CSS21/syndata.html#counter">counters()</a> function, as described in <a data-link-type="biblio" href="#biblio-css21" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS21]</a>. <dt><a class="production css" data-link-type="function" href="#funcdef-content" id="ref-for-funcdef-content①">&lt;content()></a> <dd>The <a class="css" data-link-type="maybe" href="#funcdef-content" id="ref-for-funcdef-content②">content()</a> function, described below. <dt><a class="production css" data-link-type="function" href="https://www.w3.org/TR/css-values-5/#funcdef-attr" id="ref-for-funcdef-attr①">&lt;attr()></a> <dd>An <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-values-5/#funcdef-attr" id="ref-for-funcdef-attr②">attr()</a> function, as defined in <a data-link-type="biblio" href="#biblio-css-values-3" title="CSS Values and Units Module Level 3">[CSS-VALUES-3]</a> </dl> <h5 class="heading settled" data-level="1.1.1.1" id="content-function-header"><span class="secno">1.1.1.1. </span><span class="content">The <a class="css" data-link-type="maybe" href="#funcdef-content" id="ref-for-funcdef-content③">content()</a> function</span><a class="self-link" href="#content-function-header"></a></h5> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="funcdef-content">content()</dfn> = content([text <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑤">|</a> before <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑥">|</a> after <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑦">|</a> first-letter ]) </pre> <p class="issue" id="issue-edcf4ca2"><a class="self-link" href="#issue-edcf4ca2"></a>How do we define the default value for this function?</p> <dl> <dt>text <dd>The string value of the element, determined as if <code>white-space: normal</code> had been set. This is the default value <dt>before <dd>The string value of the <code>::before</code> pseudo-element, determined as if <code>white-space: normal</code> had been set. <dt>after <dd>The string value of the <code>::after</code> pseudo-element, determined as if <code>white-space: normal</code> had been set. <dt>first-letter <dd>The first letter of the element, as defined for the <code><a href="https://www.w3.org/TR/css3-selectors/#first-letter">::first-letter</a></code> pseudo-element </dl> <p>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 <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="entry-value">entry value</dfn> for a page is the assignment in effect at the end of the previous page. The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="exit-value">exit value</dfn> for a page is the assignment in effect at the end of the current page.</p> <p>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 <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-content-3/#funcdef-string" id="ref-for-funcdef-string②">string()</a> function can return past, current, or future values of the assignment.</p> <div class="example" id="example-e698ead2"> <a class="self-link" href="#example-e698ead2"></a> <p>HTML:</p> <pre>&lt;h1>Loomings&lt;/h1> </pre> <p>CSS:</p> <pre>h1::before { content: 'Chapter ' counter(chapter); } h1 { string-set: header content(before) ':' content(text); } h1::after { content: '.'; } </pre> <p>The value of the named string “header” will be “Chapter 1: Loomings”.</p> </div> <div class="example" id="example-ba54cbec"> <a class="self-link" href="#example-ba54cbec"></a> HTML: <pre>&lt;section title="Loomings"> </pre> <p>CSS:</p> <pre>section { string-set: header attr(title) } </pre> <p>The value of the “header” string will be “Loomings”.</p> </div> <h4 class="heading settled" data-level="1.1.2" id="using-named-strings"><span class="secno">1.1.2. </span><span class="content"> The <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-content-3/#funcdef-string" id="ref-for-funcdef-string③">string()</a> function </span><a class="self-link" href="#using-named-strings"></a></h4> The <span class="css" id="ref-for-funcdef-string④">string()</span> function is used to copy the value of a named string to the document, via the <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-content-3/#propdef-content" id="ref-for-propdef-content">content</a> 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. <p>The second argument of the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-content-3/#funcdef-string" id="ref-for-funcdef-string⑤">string()</a> function is one of the following keywords:</p> <dl> <dt id="string-first"><a class="self-link" href="#string-first"></a>first <dd>The value of the first assignment on the page is used. If there is no assignment on the page, the <span class="css">entry value</span> is used. <code>first</code> is the default value. <dt id="string-start"><a class="self-link" href="#string-start"></a>start <dd>If the element is the first element on the page, the value of the first assignment is used. Otherwise the <span class="css">entry value</span> is used. The <span class="css">entry value</span> may be empty if the element hasn’t yet appeared. <dt id="string-last"><a class="self-link" href="#string-last"></a>last <dd>The <span class="css">exit value</span> of the named string is used. <dt id="string-first-except"><a class="self-link" href="#string-first-except"></a>first-except <dd>This is identical to <code>first</code>, except that the empty string is used on the page where the value is assigned. </dl> <div class="example" id="example-23e3824c"> <a class="self-link" href="#example-23e3824c"></a> CSS: <pre>@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() } </pre> <p>The following figures show the first, start, and last assignments of the “heading” string on various pages.</p> <figure> <img alt src="images/using-strings-1.jpg" width="480"> <figcaption>The <a href="#string-start">start</a> value is empty, as the string had not yet been set at the start of the page.</figcaption> </figure> <figure> <img alt src="images/using-strings-2.jpg" width="480"> <figcaption>Since the page starts with an h2, the <a href="#string-start">start</a> value is the value of that head.</figcaption> </figure> <figure> <img alt src="images/using-strings-3.jpg" width="480"> <figcaption>Since there’s not an h2 at the top of this page, the <a href="#string-start">start</a> value is the <span class="css">exit value</span> of the previous page.</figcaption> </figure> </div> <h3 class="heading settled" data-level="1.2" id="running-elements"><span class="secno">1.2. </span><span class="content"> Running elements </span><a class="self-link" href="#running-elements"></a></h3> 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 <a class="css" data-link-type="maybe" href="#funcdef-running" id="ref-for-funcdef-running">running()</a> value to the position property, and the <a class="css" data-link-type="maybe" href="#funcdef-element" id="ref-for-funcdef-element">element()</a> value to the content property. <div class="example" id="example-6cddf8e9"> <a class="self-link" href="#example-6cddf8e9"></a> <pre>@page { @top { content: element(header); } } h1 { position: running(header); } </pre> <p>In this example, the <code>h1</code> element is placed in the <code>@top</code> margin box, complete with formatting and any descendant elements. It does not display in the normal document flow.</p> </div> <h4 class="heading settled" data-level="1.2.1" id="running-syntax"><span class="secno">1.2.1. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#funcdef-running" id="ref-for-funcdef-running①">running()</a> value </span><a class="self-link" href="#running-syntax"></a></h4> <p><code>position: running(custom-ident)</code> 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 <a class="css" data-link-type="maybe" href="#funcdef-element" id="ref-for-funcdef-element①">element()</a>. The element inherits from its original position in the document, but does not display there.</p> <table class="def propdef partial" data-link-for-hint="position"> <tbody> <tr> <th>Name: <td><a class="css" data-link-type="property" href="https://www.w3.org/TR/CSS21/visuren.html#propdef-position" id="ref-for-propdef-position">position</a> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">New values:</a> <td class="prod"><a class="production css" data-link-type="function" href="#funcdef-running" id="ref-for-funcdef-running②">&lt;running()></a> </table> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="funcdef-running">running()</dfn> = running( <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value①">&lt;custom-ident></a> ) </pre> <div class="example" id="example-ffae16e8"> <a class="self-link" href="#example-ffae16e8"></a> <p>HTML:</p> <pre>&lt;p class="rh">&lt;i>Miranda v. Arizona&lt;/i> in Context&lt;/p> &lt;h2>&lt;i>Miranda v. Arizona&lt;/i> in Context&lt;/h2> </pre> <p>CSS:</p> <pre>@top-center { content: element(heading); } p.rh { position: running(heading); } p.rh::before { content: counter(page) ' / '; } </pre> <figure> <p><img alt="running header using running elements" src="images/running-element-gcpm_Page_1.jpg" width="480"></p> <figcaption>Running element in page margin box</figcaption> </figure> </div> <p class="note" role="note">The <a class="css" data-link-type="maybe" href="#funcdef-element" id="ref-for-funcdef-element②">element()</a> value can only be used in page margin boxes. And it cannot be combined with other possible values for the content property.</p> <div class="issue" id="issue-00e0aa3c"> <a class="self-link" href="#issue-00e0aa3c"></a> <p>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. </p> <p>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.</p> <div class="example" id="example-ffc3e328"> <a class="self-link" href="#example-ffc3e328"></a> <pre>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); } } </pre> </div> <table class="def propdef" data-link-for-hint="running"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-running">running</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value②">&lt;custom-ident></a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>elements <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified value <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <p class="all-media">User agents are expected to support this property on all media, including non-visual ones.</p> </div> <h4 class="heading settled" data-level="1.2.2" id="element-syntax"><span class="secno">1.2.2. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#funcdef-element" id="ref-for-funcdef-element③">element()</a> value </span><a class="self-link" href="#element-syntax"></a></h4> <p>The <a class="css" data-link-type="maybe" href="#funcdef-element" id="ref-for-funcdef-element④">element()</a> value of the content property places an element (which has been removed from the normal flow via <a class="css" data-link-type="maybe" href="#funcdef-running" id="ref-for-funcdef-running③">running()</a>) in a page margin box. Whenever the value of the element changes, the value of <span class="css" id="ref-for-funcdef-element⑤">element()</span> is updated.</p> <p>Just as with <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-content-3/#funcdef-string" id="ref-for-funcdef-string⑥">string()</a>, <a class="css" data-link-type="maybe" href="#funcdef-element" id="ref-for-funcdef-element⑥">element()</a> 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 <span class="css" id="ref-for-funcdef-element⑦">element()</span> can return past, current, or future values of the assignment.</p> <table class="def propdef partial" data-link-for-hint="content"> <tbody> <tr> <th>Name: <td><a class="css" data-link-type="property" href="https://www.w3.org/TR/css-content-3/#propdef-content" id="ref-for-propdef-content①">content</a> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">New values:</a> <td class="prod"><a class="production css" data-link-type="function" href="#funcdef-element" id="ref-for-funcdef-element⑧">&lt;element()></a> </table> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="funcdef-element">element()</dfn> = element( <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value③">&lt;custom-ident></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma">,</a> [ first <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑧">|</a> start <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑨">|</a> last <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⓪">|</a> first-except ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt">?</a> ) </pre> <h2 class="heading settled" data-level="2" id="footnotes"><span class="secno">2. </span><span class="content"> Footnotes </span><a class="self-link" href="#footnotes"></a></h2> 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. <h3 class="heading settled" data-level="2.1" id="footnote-terms"><span class="secno">2.1. </span><span class="content">Terminology</span><a class="self-link" href="#footnote-terms"></a></h3> <p>Footnotes are complex objects (see the <a href="https://www.w3.org/TR/dpub-latinreq/#footnotes">footnote section</a> at <a data-link-type="biblio" href="#biblio-dpub-latinreq" title="Requirements for Latin Text Layout and Pagination">[dpub-latinreq]</a>), so it will be helpful to define some terms before proceeding.</p> <figure> <p><img alt="page with footnotes" src="images/footnote-diagram.001.jpg" width="480"></p> <figcaption>Footnote terminology</figcaption> </figure> <dl> <dt>footnote element <dd>The element containing the content of the footnote, which will be removed from the flow and displayed as a footnote. <dt>footnote marker (also known as footnote number) <dd>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. <dt>footnote body <dd>The footnote marker is placed before the footnote element, and together they represent the footnote body, which will be placed in the footnote area. <dt>footnote call (also known as footnote reference) <dd>A number or symbol, found in the main text, which points to the footnote body. <dt>footnote area <dd>The page area used to display footnotes. <dt>footnote rule (also known as footnote separator) <dd>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. </dl> <h3 class="heading settled" data-level="2.2" id="creating-footnotes"><span class="secno">2.2. </span><span class="content"> Creating footnotes </span><a class="self-link" href="#creating-footnotes"></a></h3> An element becomes a footnote by applying <code>float: footnote</code> to that element. This triggers the following actions: <ol> <li> The footnote element is removed from the flow, and a <code>::footnote-call</code> pseudo-element is inserted in its place, which serves as a reference to the footnote. <li> A <code>::footnote-marker</code> pseudo-element, identifying the footnote, is placed at the beginning of the footnote element. Together this is the footnote body. <li>The <span class="css">footnote counter</span> is incremented. <li>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. </ol> <div class="example" id="example-efe978c0"> <a class="self-link" href="#example-efe978c0"></a> HTML: <pre style="word-wrap: break-word; white-space: pre-wrap;">&lt;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.&lt;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.&lt;/span>&lt;/p> </pre> <p>CSS:</p> <pre>@page { @footnote { float: bottom; } } span.footnote { float: footnote; } </pre> </div> <p class="issue" id="issue-4af1f674"><a class="self-link" href="#issue-4af1f674"></a>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.</p> <h3 class="heading settled" data-level="2.3" id="footnote-types"><span class="secno">2.3. </span><span class="content"> Types of footnotes </span><a class="self-link" href="#footnote-types"></a></h3> The following new value of the <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css2/#propdef-float" id="ref-for-propdef-float">float</a> property creates a footnote element: <table class="def propdef partial" data-link-for-hint="float"> <tbody> <tr> <th>Name: <td><a class="css" data-link-type="property" href="https://drafts.csswg.org/css2/#propdef-float" id="ref-for-propdef-float①">float</a> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">New values:</a> <td class="prod">footnote </table> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="float" data-dfn-type="value" data-export id="valdef-float-footnote">footnote</dfn> <dd>each footnote element is placed in the footnote area of the page </dl> <p>The <a class="property css" data-link-type="property" href="#propdef-footnote-display" id="ref-for-propdef-footnote-display">footnote-display</a> property determines whether a footnote is displayed as a block element or inline element.</p> <table class="def propdef" data-link-for-hint="footnote-display"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-footnote-display">footnote-display</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod">block <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①①">|</a> inline <span id="ref-for-comb-one①②">|</span> compact <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>block <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>elements <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified value <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="footnote-display" data-dfn-type="value" data-export id="footnote-display-block">block</dfn> <dd>The footnote element is placed in the footnote area as a block element <dt><dfn class="dfn-paneled css" data-dfn-for="footnote-display" data-dfn-type="value" data-export id="footnote-display-inline">inline</dfn> <dd>The footnote element is placed in the footnote area as an inline element <dt><dfn class="dfn-paneled css" data-dfn-for="footnote-display" data-dfn-type="value" data-export id="footnote-display-compact">compact</dfn> <dd>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. </dl> <h3 class="heading settled" data-level="2.4" id="footnote-area"><span class="secno">2.4. </span><span class="content"> The footnote area </span><a class="self-link" href="#footnote-area"></a></h3> A <a href="https://drafts.csswg.org/css-page/#page-area">page area</a> that can be used to display footnotes is described in the <a href="https://drafts.csswg.org/css-page/#page-context">page context</a> using an <code>@footnote</code> rule. This rule defines a box that, if used, will contain all the footnote elements that appear on that page. <p class="issue" id="issue-829ce977"><a class="self-link" href="#issue-829ce977"></a>How would one describe this in the grammar of CSS3-Page?</p> <h4 class="heading settled" data-level="2.4.1" id="footnote-area-position"><span class="secno">2.4.1. </span><span class="content">Positioning of the footnote area</span><a class="self-link" href="#footnote-area-position"></a></h4> 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. <p class="issue" id="issue-069a39a3"><a class="self-link" href="#issue-069a39a3"></a>How do footnotes work in multi-column text? Prince uses <code>float: prince-column-footnote</code> to create a footnote at the bottom of a column rather than the bottom of a page.</p> <p class="issue" id="issue-34f910d8"><a class="self-link" href="#issue-34f910d8"></a>Implementations that support footnotes generally support page floats like <code>float: bottom</code>. Page floats should end up above the footnote area. How might this be specified?</p> <h4 class="heading settled" data-level="2.4.2" id="footnote-area-size"><span class="secno">2.4.2. </span><span class="content">Size of the footnote area</span><a class="self-link" href="#footnote-area-size"></a></h4> <p>The <a class="property css" data-link-type="property">max-height</a> 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).</p> <p>Since it is undesirable for a page to consist only of footnotes, user agents <em class="RFC2119">may</em> set a default max-height value on the footnote area.</p> <h3 class="heading settled" data-level="2.5" id="footnote-counters"><span class="secno">2.5. </span><span class="content">The Footnote Counter</span><a class="self-link" href="#footnote-counters"></a></h3> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="footnote-counter">footnote counter</dfn> is a predefined <a href="https://drafts.csswg.org/css-lists/#counter">counter</a> 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.</p> <h4 class="heading settled" data-level="2.5.1" id="footnote-counter-values"><span class="secno">2.5.1. </span><span class="content">Values of the footnote counter</span><a class="self-link" href="#footnote-counter-values"></a></h4> <p>The footnote counter, like other counters, may use any <a href="https://drafts.csswg.org/css-counter-styles-3/#counter-style">counter style</a>. Footnotes often use a sequence of symbols.</p> <div class="example" id="example-c28d19f0"> <a class="self-link" href="#example-c28d19f0"></a> <pre>::footnote-call { content: counter(footnote, symbols('*', '†', '‡', '§')); } ::footnote-marker { content: counter(footnote, symbols('*', '†', '‡', '§')) '. '; } </pre> </div> <h4 class="heading settled" data-level="2.5.2" id="resetting-footnote-counter"><span class="secno">2.5.2. </span><span class="content">Resetting the footnote counter</span><a class="self-link" href="#resetting-footnote-counter"></a></h4> <p>The footnote counter may be reset on each page.</p> <div class="example" id="example-50e9e077"> <a class="self-link" href="#example-50e9e077"></a> <pre>@page { counter-reset: footnote; @footnote { … } } </pre> </div> <p>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.</p> <h3 class="heading settled" data-level="2.6" id="footnote-call"><span class="secno">2.6. </span><span class="content"> The <code>footnote-call</code> pseudo-element </span><a class="self-link" href="#footnote-call"></a></h3> A <code>::footnote-call</code> 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. <div class="example" id="example-eda00cbe"> <a class="self-link" href="#example-eda00cbe"></a> <pre>::footnote-call { content: counter(footnote); vertical-align: baseline; font-size: 100%; line-height: inherit; font-variant-position: super; } </pre> </div> <h3 class="heading settled" data-level="2.7" id="footnote-marker"><span class="secno">2.7. </span><span class="content"> The <code>footnote-marker</code> pseudo-element </span><a class="self-link" href="#footnote-marker"></a></h3> The <code>::footnote-marker</code> pseudo-element represents the footnote element’s marker, the number or symbol that identifies each footnote. This pseudo-element behaves like a <code>::marker</code> pseudo-element, as defined in <a data-link-type="biblio" href="#biblio-css3list" title="CSS Lists and Counters Module Level 3">[CSS3LIST]</a>. It is placed at the beginning of the superior parent’s content, and is inline by default. The <code>::footnote-marker</code> can be styled just as other <code>::marker</code> elements can be. The default style should include <code>list-style-position: inside</code>. <div class="example" id="example-64cfffb1"> <a class="self-link" href="#example-64cfffb1"></a> <pre>::footnote-marker { content: counter(footnote); } ::footnote-marker::after { content: '. '; } </pre> </div> <h3 class="heading settled" data-level="2.8" id="footnote-policy"><span class="secno">2.8. </span><span class="content"> Rendering footnotes and <code>footnote policy</code> </span><a class="self-link" href="#footnote-policy"></a></h3> <p>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 <a class="property css" data-link-type="property" href="#propdef-footnote-policy" id="ref-for-propdef-footnote-policy">footnote-policy</a> property allows authors some influence over the rendering of difficult pages.</p> <table class="def propdef" data-link-for-hint="footnote-policy"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-footnote-policy">footnote-policy</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod">auto <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①③">|</a> line <span id="ref-for-comb-one①④">|</span> block <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>auto <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>elements <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified value <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="footnote-policy" data-dfn-type="value" data-export id="valdef-footnote-policy-auto">auto</dfn> <dd>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. <dt><dfn class="dfn-paneled css" data-dfn-for="footnote-policy" data-dfn-type="value" data-export id="footnote-policy-line">line</dfn> <dd>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 <a href="https://drafts.csswg.org/css-break/#widows-orphans">widow and orphan</a> settings when doing this, and so may need to insert the page break on an earlier line. <dt><dfn class="dfn-paneled css" data-dfn-for="footnote-policy" data-dfn-type="value" data-export id="valdef-footnote-policy-block">block</dfn> <dd>As with <a href="#footnote-policy-line" id="ref-for-footnote-policy-line">line</a>, except a forced page break is introduced before the paragraph that contains the footnote. </dl> <p class="issue" id="issue-da883bb8"><a class="self-link" href="#issue-da883bb8"></a>We need an algorithm for laying out footnotes</p> <h3 class="heading settled" data-level="2.9" id="future"><span class="secno">2.9. </span><span class="content"> Future directions </span><a class="self-link" href="#future"></a></h3> The next level will include sidenotes, column footnotes, and multiple footnote areas. <h2 class="heading settled" data-level="3" id="the-first-page-pseudo-element"><span class="secno">3. </span><span class="content"> Selecting Pages </span><a class="self-link" href="#the-first-page-pseudo-element"></a></h2> <p>A paginated document consists of a sequence of pages. <a data-link-type="biblio" href="#biblio-css3page" title="CSS Paged Media Module Level 3">[CSS3PAGE]</a> defines <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="page-selectors">page selectors</dfn>, 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.</p> <h3 class="heading settled" data-level="3.1" id="document-page-selectors"><span class="secno">3.1. </span><span class="content"> Page Selectors </span><a class="self-link" href="#document-page-selectors"></a></h3> The <a class="css" data-link-type="maybe" href="#selectordef-nth" id="ref-for-selectordef-nth">:nth()</a> page pseudo-class allows the selection of arbitrary document pages. This pseudo-class takes an argument of the form <a href="https://drafts.csswg.org/css-syntax/#anb">An + B</a> as defined in <a data-link-type="biblio" href="#biblio-css3syn" title="CSS Syntax Module Level 3">[CSS3SYN]</a>. When applied to the default @page rule, <span class="css" id="ref-for-selectordef-nth①">:nth()</span> selects the document page whose index matches the argument. <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="selector" data-export id="selectordef-nth">:nth()</dfn> = :nth( <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-syntax-3/#anb-production" id="ref-for-anb-production">&lt;an+b></a> [of <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value④">&lt;custom-ident></a>]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt①">?</a> ) </pre> <p class="note" role="note"> <a class="css" data-link-type="maybe" href="#selectordef-nth" id="ref-for-selectordef-nth②">:nth()</a> is not related to the page counter, which may reset and use various numbering schemes.</p> <p>When the <a class="css" data-link-type="maybe" href="#selectordef-nth" id="ref-for-selectordef-nth③">:nth()</a> 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.</p> <div class="example" id="example-b3ec403f"> <a class="self-link" href="#example-b3ec403f"></a> <pre>@page :nth(1) </pre> <p>This selects the first page of the document.</p> <pre>@page :nth(2n) </pre> This selects all even document pages. </div> <h3 class="heading settled" data-level="3.2" id="document-sequence-selectors"><span class="secno">3.2. </span><span class="content"> Page groups </span><a class="self-link" href="#document-sequence-selectors"></a></h3> 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 <span title="CSS Paged Media Module Level 3">[CSS3PAGE]</span> doesn’t define a way to select the first page of each chapter (as distinct from the first page of the entire document). <p>When the <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-page-3/#propdef-page" id="ref-for-propdef-page">page</a> property is applied to an element that also has a forced break property applied, a <span class="css">page group</span> is created. The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="page-group">page group</dfn> is the collection of all pages created by an instance of that element. When a new instance of the element is rendered, a new <span class="css">page group</span> is started.</p> <p>A page may be part of several page groups, as a given <span class="css">page group</span> may have ancestors or descendants that are part of another <span class="css">page group</span>.</p> <div class="example" id="example-79ba6f1d"> <a class="self-link" href="#example-79ba6f1d"></a> CSS: <pre>div { page: A; break-before: page; } child { page: B; break-before: page; } </pre> <figure> <img alt src="images/PageGroups.001.jpg" width="480"> <figcaption>A page may be part of several page groups.</figcaption> </figure> Note that page 5 can be selected in three ways: <pre>@page :nth(5 of A) /* will select 5th page of every &lt;div> */ @page :nth(1 of B) /* will select first page of every &lt;child> */ @page :nth(5) /* will select 5th page of document */ </pre> </div> <div class="example" id="example-f344cdfc"> <a class="self-link" href="#example-f344cdfc"></a> <p>Consider the following HTML:</p> <pre>&lt;div class="chapter"> &lt;h1>Chapter One&lt;/h1> &lt;p>some text&lt;/p> &lt;table class="broadside"> ... &lt;/table> ... &lt;/div> &lt;div class="chapter"> &lt;h1>Chapter Two&lt;/h1> &lt;p>some text&lt;/p> ... &lt;table class="broadside"> ... &lt;/table> ... &lt;/div> </pre> <p>And CSS:</p> <pre>div.chapter { page: body; break-before: page; } table.broadside { page: broadside; break-before: page; } </pre> <p>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.</p> </div> <h2 class="heading settled" data-level="4" id="leaders"><span class="secno">4. </span><span class="content"> Leaders (moved) </span><a class="self-link" href="#leaders"></a></h2> <p class="issue" id="issue-1a552eac"><a class="self-link" href="#issue-1a552eac"></a> Now described in <a data-link-type="biblio" href="#biblio-css3-content" title="CSS Generated Content Module Level 3">[CSS3-CONTENT]</a></p> <h2 class="heading settled" data-level="5" id="cross-references"><span class="secno">5. </span><span class="content"> Cross-references (moved) </span><a class="self-link" href="#cross-references"></a></h2> <p class="issue" id="issue-1a552eac①"><a class="self-link" href="#issue-1a552eac①"></a> Now described in <a data-link-type="biblio" href="#biblio-css3-content" title="CSS Generated Content Module Level 3">[CSS3-CONTENT]</a></p> <h2 class="heading settled" data-level="6" id="bookmarks"><span class="secno">6. </span><span class="content"> Bookmarks (moved) </span><a class="self-link" href="#bookmarks"></a></h2> <p class="issue" id="issue-1a552eac②"><a class="self-link" href="#issue-1a552eac②"></a> Now described in <a data-link-type="biblio" href="#biblio-css3-content" title="CSS Generated Content Module Level 3">[CSS3-CONTENT]</a></p> <h2 class="no-num heading settled" id="former-wd-sections"><span class="content">Appendix A: Where Are They Now?</span><a class="self-link" href="#former-wd-sections"></a></h2> <p>Many sections which were in the <a href="https://www.w3.org/TR/2011/WD-css3-gcpm-20111129/">29 November 2011 Working Draft</a> have been moved to other specifications. Here are some notes on where things have moved.</p> <h3 class="heading settled" id="page-marks-and-bleed-area"><span class="content">Page marks and bleed area</span><a class="self-link" href="#page-marks-and-bleed-area"></a></h3> <p class="note" role="note">This section has been moved to <a href="https://drafts.csswg.org/css-page/#marks">CSS Paged Media Module Level 3</a>.</p> <h3 class="heading settled" id="cmyk-colors"><span class="content">CMYK colors</span><a class="self-link" href="#cmyk-colors"></a></h3> <p class="note" role="note">This section has been moved to <a href="https://drafts.csswg.org/css-color-5/#device-cmyk">CSS Color Module Level 5</a>.</p> <h3 class="heading settled" id="styling-blank-pages"><span class="content">Styling blank pages</span><a class="self-link" href="#styling-blank-pages"></a></h3> <p class="note" role="note">This section has been moved to <a href="https://drafts.csswg.org/css-page/#blank-pseudo">CSS Paged Media Module Level 3</a></p> <h3 class="heading settled" id="paged-presentations"><span class="content">Paged presentations</span><a class="self-link" href="#paged-presentations"></a></h3> <p class="note" role="note">This section has been moved to <a href="https://drafts.csswg.org/css-overflow-4/#overflow-concepts">CSS Overflow Module Level 4</a>.</p> <h3 class="heading settled" id="navigation-between-pages"><span class="content">Navigation between pages</span><a class="self-link" href="#navigation-between-pages"></a></h3> <p class="note" role="note">This is discussed in <a href="http://books.spec.whatwg.org/#spatial-layout-of-pages;-@layout">WHATWG CSS Books</a>.</p> <h3 class="heading settled" id="page-floats"><span class="content">Page floats</span><a class="self-link" href="#page-floats"></a></h3> <p class="note" role="note">This section has been moved to <a href="https://drafts.csswg.org/css-page-floats/">CSS Page Floats</a>.</p> <h3 class="heading settled" id="selecting-columns-and-pages"><span class="content">Selecting columns and pages</span><a class="self-link" href="#selecting-columns-and-pages"></a></h3> <p class="note" role="note">A brief mention of selecting columns is found in <a href="http://books.spec.whatwg.org/#selecting-columns">WHATWG CSS Books</a>.</p> <h2 class="no-num heading settled" id="ua-stylesheet"><span class="content">Appendix B: Default UA Stylesheet</span><a class="self-link" href="#ua-stylesheet"></a></h2> <p>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. </p> <div class="example" id="example-0a0ebdaf"> <a class="self-link" href="#example-0a0ebdaf"></a> <pre>@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 } </pre> </div> <h2 class="no-num heading settled" id="changes"><span class="content">Appendix C: Changes</span><a class="self-link" href="#changes"></a></h2> <p>Changes since the <a href="https://www.w3.org/TR/2014/WD-css-gcpm-3-20140513/">13 May 2014 Working Draft</a>:</p> <ul> <li>Clarify that bookmark is only created via <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-content-3/#propdef-bookmark-level" id="ref-for-propdef-bookmark-level">bookmark-level</a> property. Remove <span class="css">none</span> value from <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-content-3/#propdef-bookmark-label" id="ref-for-propdef-bookmark-label">bookmark-label</a>. <li>Move the cross references, leaders, and bookmarks sections to the <a href="https://www.w3.org/TR/css-content-3/">CSS Generated Content Module</a>. <li>Incorrect break values were fixed. See <a href="https://github.com/w3c/csswg-drafts/issues/3524">Issue #3524</a>. <li>The spec has new editors. </ul> <p>Changes since the <a href="https://hg.csswg.org/drafts/raw-file/6a5c44d11c2b/css-gcpm/Overview.html">24 September 2013 Editor’s Draft</a>:</p> <ul> <li>The spec has a new editor. <li>All text and examples rewritten. <li>Added <span class="css">attr(&lt;identifier>)</span> value to <a class="property css" data-link-type="property" href="#propdef-string-set" id="ref-for-propdef-string-set②">string-set</a> property. This is supported by both Prince and AntennaHouse. <li>Added <a class="property css" data-link-type="property" href="#propdef-footnote-policy" id="ref-for-propdef-footnote-policy①">footnote-policy</a> property to control rendering of footnotes in difficult situations. <li>Added <a class="property css" data-link-type="property" href="#propdef-footnote-display" id="ref-for-propdef-footnote-display①">footnote-display</a> property to allow inline footnotes. <li>Removed sidenotes section. <li>Removed section on selecting elements within pages and columns <li>Removed page-group property, and added optional argument to nth() page pseudo-class to allow selection within page groups. </ul> <p>Changes since the <a href="https://www.w3.org/TR/2011/WD-css3-gcpm-20111129/">29 November 2011 Working Draft</a>:</p> <ul> <li> Page Marks and Bleeds section moved to <a href="https://drafts.csswg.org/css-page/#marks">CSS Paged Media Module Level 3</a> <li> CMYK Colors section moved to <a href="https://drafts.csswg.org/css-color-5/#device-cmyk">CSS Colors Level 5</a>. <li> Styling Blank Pages section deleted <li> Paged Presentations section moved to <a href="https://drafts.csswg.org/css-overflow-3/#overflow-concepts">CSS Overflow Module Level 3</a>. <li> Navigation Between Pages moved to <a href="http://books.spec.whatwg.org/#spatial-layout-of-pages;-@layout">WHATWG CSS Books</a> <li> Page floats section moved to <a href="https://drafts.csswg.org/css-page-floats/">CSS Page Floats</a> <li> First-page pseudo-element section deleted <li> Selecting Columns and Pages section deleted <li> env() function removed from string-set property <li> alignment values of leaders removed <li> leader specified to occupy only a single line <li> content() value of target-text changed to content(text) <li> target-pull() value of content property removed </ul> <p>Differences with the <a href="http://books.ideas.whatwg.org/">WHATWG CSS Books</a> specification:</p> <ul> <li>Added <span class="css">attr(&lt;identifier>)</span> value to <a class="property css" data-link-type="property" href="#propdef-string-set" id="ref-for-propdef-string-set③">string-set</a> property. This is supported by both Prince and AntennaHouse. <li> <a href="http://books.ideas.whatwg.org/">CSS Books</a> does not have the <a class="property css" data-link-type="property" href="#propdef-footnote-display" id="ref-for-propdef-footnote-display②">footnote-display</a> property. <li> <a href="http://books.ideas.whatwg.org/">CSS Books</a> does not have the <a class="property css" data-link-type="property" href="#propdef-footnote-policy" id="ref-for-propdef-footnote-policy②">footnote-policy</a> property. <li> The relationship between the <code>nth()</code> page pseudo-class and the page-group concept is clarified, which may make the page-group property redundant. <li> This specification does not redefine the <code>:first</code> page pseudo-selector to select the first page of a page-group. <li> This specification does not consider: <ol> <li> Named areas <li> Selecting elements within pages <li> The <code>range()</code> page pseudo-class <li> Selecting columns <li> Baseline rhythms <li> Extending the box model <li> Character substitution <li> Microtypography </ol> </ul> <h2 class="no-num heading settled" id="privacy"><span class="content">Privacy Considerations</span><a class="self-link" href="#privacy"></a></h2> <p>No new privacy considerations have been reported on this specification.</p> <h2 class="no-num heading settled" id="security"><span class="content">Security Considerations</span><a class="self-link" href="#security"></a></h2> <p>No new security considerations have been reported on this specification.</p> <h2 class="no-num heading settled" id="acknowledgments"><span class="content"> Acknowledgments </span><a class="self-link" href="#acknowledgments"></a></h2> This work would not be possible without the immense contributions of Håkon Wium Lie. <p>Chris Lilley, Elika J. Etemad, Alan Stearns, L. David Baron, Bert Bos, Florian Rivoal, [$your_name, ", " ]+ and Liam Quin have provided valuable feedback.</p> </main> <h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content"> Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2> <h3 class="no-ref heading settled" id="w3c-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#w3c-conventions"></a></h3> <p>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. </p> <p>All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</a></p> <p>Examples in this specification are introduced with the words “for example” or are set apart from the normative text with <code>class="example"</code>, like this: </p> <div class="example" id="w3c-example"> <a class="self-link" href="#w3c-example"></a> <p>This is an example of an informative example.</p> </div> <p>Informative notes begin with the word “Note” and are set apart from the normative text with <code>class="note"</code>, like this: </p> <p class="note" role="note">Note, this is an informative note.</p> <p>Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <code>&lt;strong class="advisement"></code>, like this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong></p> <h3 class="no-ref heading settled" id="w3c-conformance-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#w3c-conformance-classes"></a></h3> <p>Conformance to this specification is defined for three conformance classes: </p> <dl> <dt>style sheet <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS style sheet</a>. <dt>renderer <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders documents that use them. <dt>authoring tool <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that writes a style sheet. </dl> <p>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. </p> <p>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.) </p> <p>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. </p> <h3 class="no-ref heading settled" id="w3c-partial"><span class="content"> Partial implementations</span><a class="self-link" href="#w3c-partial"></a></h3> <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers <strong>must</strong> treat as invalid (and <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignore as appropriate</a>) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents <strong>must not</strong> 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.</p> <h4 class="heading settled" id="w3c-conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#w3c-conform-future-proofing"></a></h4> <p>To avoid clashes with future stable CSS features, the CSSWG recommends <a href="https://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="https://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="https://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p> <h3 class="no-ref heading settled" id="w3c-testing"><span class="content"> Non-experimental implementations</span><a class="self-link" href="#w3c-testing"></a></h3> <p>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. </p> <p>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. </p> <p>Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at <a href="https://www.w3.org/Style/CSS/Test/">https://www.w3.org/Style/CSS/Test/</a>. Questions should be directed to the <a href="https://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.</p> <script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script> <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li><a href="#valdef-footnote-policy-auto">auto</a><span>, in § 2.8</span> <li> block <ul> <li><a href="#footnote-display-block">value for footnote-display</a><span>, in § 2.3</span> <li><a href="#valdef-footnote-policy-block">value for footnote-policy</a><span>, in § 2.8</span> </ul> <li><a href="#footnote-display-compact">compact</a><span>, in § 2.3</span> <li><a href="#funcdef-content">content()</a><span>, in § 1.1.1.1</span> <li><a href="#content-list">&lt;content-list></a><span>, in § 1.1.1</span> <li><a href="#funcdef-element">element()</a><span>, in § 1.2.2</span> <li><a href="#entry-value">entry value</a><span>, in § 1.1.1.1</span> <li><a href="#exit-value">exit value</a><span>, in § 1.1.1.1</span> <li><a href="#valdef-float-footnote">footnote</a><span>, in § 2.3</span> <li><a href="#footnote-counter">footnote counter</a><span>, in § 2.5</span> <li><a href="#propdef-footnote-display">footnote-display</a><span>, in § 2.3</span> <li><a href="#propdef-footnote-policy">footnote-policy</a><span>, in § 2.8</span> <li><a href="#footnote-display-inline">inline</a><span>, in § 2.3</span> <li><a href="#footnote-policy-line">line</a><span>, in § 2.8</span> <li><a href="#named-string">named string</a><span>, in § 1</span> <li><a href="#selectordef-nth">:nth()</a><span>, in § 3.1</span> <li><a href="#page-group">page group</a><span>, in § 3.2</span> <li><a href="#page-selectors">page selectors</a><span>, in § 3</span> <li><a href="#propdef-running">running</a><span>, in § 1.2.1</span> <li><a href="#funcdef-running">running()</a><span>, in § 1.2.1</span> <li><a href="#running-elements0">Running elements</a><span>, in § 1</span> <li><a href="#propdef-string-set">string-set</a><span>, in § 1.1.1</span> </ul> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[CSS-VALUES-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="c297b070">#</span> <li><span class="dfn-paneled" id="af4a190d">+</span> <li><span class="dfn-paneled" id="8cd4f032">,</span> <li><span class="dfn-paneled" id="a0144f62">&lt;custom-ident></span> <li><span class="dfn-paneled" id="1d798932">&lt;string></span> <li><span class="dfn-paneled" id="d4441b24">?</span> <li><span class="dfn-paneled" id="8a110a7b">CSS-wide keywords</span> <li><span class="dfn-paneled" id="4eb9d37e">|</span> </ul> <li> <a data-link-type="biblio">[CSS-VALUES-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="a20cee51">attr()</span> </ul> <li> <a data-link-type="biblio">[CSS21]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="dc76e65c">position</span> </ul> <li> <a data-link-type="biblio">[CSS22]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="0570259e">float</span> </ul> <li> <a data-link-type="biblio">[CSS3-CONTENT]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="b246dfdc">bookmark-label</span> <li><span class="dfn-paneled" id="7e7c0df8">bookmark-level</span> <li><span class="dfn-paneled" id="f3e8378c">content</span> <li><span class="dfn-paneled" id="ecfae07b">string()</span> </ul> <li> <a data-link-type="biblio">[CSS3LIST]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="598f7b8c">counter()</span> <li><span class="dfn-paneled" id="a3e443ae">counters()</span> </ul> <li> <a data-link-type="biblio">[CSS3PAGE]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="ce1025d0">page</span> </ul> <li> <a data-link-type="biblio">[CSS3SYN]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="b2862018">&lt;an+b></span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-css-values-3">[CSS-VALUES-3] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-3/"><cite>CSS Values and Units Module Level 3</cite></a>. 22 March 2024. CR. URL: <a href="https://www.w3.org/TR/css-values-3/">https://www.w3.org/TR/css-values-3/</a> <dt id="biblio-css-values-4">[CSS-VALUES-4] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/"><cite>CSS Values and Units Module Level 4</cite></a>. 12 March 2024. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a> <dt id="biblio-css-values-5">[CSS-VALUES-5] <dd>Tab Atkins Jr.; Elika Etemad; Miriam Suzanne. <a href="https://www.w3.org/TR/css-values-5/"><cite>CSS Values and Units Module Level 5</cite></a>. 11 November 2024. WD. URL: <a href="https://www.w3.org/TR/css-values-5/">https://www.w3.org/TR/css-values-5/</a> <dt id="biblio-css21">[CSS21] <dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS21/"><cite>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</cite></a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS21/">https://www.w3.org/TR/CSS21/</a> <dt id="biblio-css22">[CSS22] <dd>Bert Bos. <a href="https://www.w3.org/TR/CSS22/"><cite>Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification</cite></a>. 12 April 2016. WD. URL: <a href="https://www.w3.org/TR/CSS22/">https://www.w3.org/TR/CSS22/</a> <dt id="biblio-css3-content">[CSS3-CONTENT] <dd>Elika Etemad; Dave Cramer. <a href="https://www.w3.org/TR/css-content-3/"><cite>CSS Generated Content Module Level 3</cite></a>. 2 August 2019. WD. URL: <a href="https://www.w3.org/TR/css-content-3/">https://www.w3.org/TR/css-content-3/</a> <dt id="biblio-css3list">[CSS3LIST] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-lists-3/"><cite>CSS Lists and Counters Module Level 3</cite></a>. 17 November 2020. WD. URL: <a href="https://www.w3.org/TR/css-lists-3/">https://www.w3.org/TR/css-lists-3/</a> <dt id="biblio-css3page">[CSS3PAGE] <dd>Elika Etemad. <a href="https://www.w3.org/TR/css-page-3/"><cite>CSS Paged Media Module Level 3</cite></a>. 14 September 2023. WD. URL: <a href="https://www.w3.org/TR/css-page-3/">https://www.w3.org/TR/css-page-3/</a> <dt id="biblio-css3syn">[CSS3SYN] <dd>Tab Atkins Jr.; Simon Sapin. <a href="https://www.w3.org/TR/css-syntax-3/"><cite>CSS Syntax Module Level 3</cite></a>. 24 December 2021. CR. URL: <a href="https://www.w3.org/TR/css-syntax-3/">https://www.w3.org/TR/css-syntax-3/</a> <dt id="biblio-rfc2119">[RFC2119] <dd>S. Bradner. <a href="https://datatracker.ietf.org/doc/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. March 1997. Best Current Practice. URL: <a href="https://datatracker.ietf.org/doc/html/rfc2119">https://datatracker.ietf.org/doc/html/rfc2119</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-dpub-latinreq">[DPUB-LATINREQ] <dd>Dave Cramer. <a href="https://www.w3.org/TR/dpub-latinreq/"><cite>Requirements for Latin Text Layout and Pagination</cite></a>. 30 September 2014. WD. URL: <a href="https://www.w3.org/TR/dpub-latinreq/">https://www.w3.org/TR/dpub-latinreq/</a> </dl> <h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2> <div class="big-element-wrapper"> <table class="index"> <thead> <tr> <th scope="col">Name <th scope="col">Value <th scope="col">Initial <th scope="col">Applies to <th scope="col">Inh. <th scope="col">%ages <th scope="col">Anim­ation type <th scope="col">Canonical order <th scope="col">Com­puted value <tbody> <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-footnote-display" id="ref-for-propdef-footnote-display③">footnote-display</a> <td>block | inline | compact <td>block <td>elements <td>no <td>N/A <td>discrete <td>per grammar <td>specified value <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-footnote-policy" id="ref-for-propdef-footnote-policy③">footnote-policy</a> <td>auto | line | block <td>auto <td>elements <td>no <td>N/A <td>discrete <td>per grammar <td>specified value <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-running" id="ref-for-propdef-running">running</a> <td>&lt;custom-ident> <td>none <td>elements <td>no <td>N/A <td>discrete <td>per grammar <td>specified value <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-string-set" id="ref-for-propdef-string-set④">string-set</a> <td>[ &lt;custom-ident> &lt;content-list> ]# | none <td>none <td>all elements, but not pseudo-elements <td>no <td>N/A <td>discrete <td>per grammar <td>specified value </table> </div> <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2> <div style="counter-reset:issue"> <div class="issue">How do we define the default value for this function? <a class="issue-return" href="#issue-edcf4ca2" title="Jump to section">↵</a></div> <div class="issue"> <p>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. </p> <p>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.</p> <div class="example"> <pre>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); } } </pre> </div> <table class="def propdef" data-link-for-hint="running"> <tbody> <tr> <th>Name: <td><span>running</span> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value">&lt;custom-ident></a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>elements <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified value <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <p class="all-media">User agents are expected to support this property on all media, including non-visual ones.</p> <a class="issue-return" href="#issue-00e0aa3c" title="Jump to section">↵</a> </div> <div class="issue">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. <a class="issue-return" href="#issue-4af1f674" title="Jump to section">↵</a></div> <div class="issue">How would one describe this in the grammar of CSS3-Page? <a class="issue-return" href="#issue-829ce977" title="Jump to section">↵</a></div> <div class="issue">How do footnotes work in multi-column text? Prince uses <code>float: prince-column-footnote</code> to create a footnote at the bottom of a column rather than the bottom of a page. <a class="issue-return" href="#issue-069a39a3" title="Jump to section">↵</a></div> <div class="issue">Implementations that support footnotes generally support page floats like <code>float: bottom</code>. Page floats should end up above the footnote area. How might this be specified? <a class="issue-return" href="#issue-34f910d8" title="Jump to section">↵</a></div> <div class="issue">We need an algorithm for laying out footnotes <a class="issue-return" href="#issue-da883bb8" title="Jump to section">↵</a></div> <div class="issue"> Now described in <a data-link-type="biblio" href="#biblio-css3-content" title="CSS Generated Content Module Level 3">[CSS3-CONTENT]</a> <a class="issue-return" href="#issue-1a552eac" title="Jump to section">↵</a></div> <div class="issue"> Now described in <a data-link-type="biblio" href="#biblio-css3-content" title="CSS Generated Content Module Level 3">[CSS3-CONTENT]</a> <a class="issue-return" href="#issue-1a552eac①" title="Jump to section">↵</a></div> <div class="issue"> Now described in <a data-link-type="biblio" href="#biblio-css3-content" title="CSS Generated Content Module Level 3">[CSS3-CONTENT]</a> <a class="issue-return" href="#issue-1a552eac②" title="Jump to section">↵</a></div> </div> <script>/* Boilerplate: script-dom-helper */ "use strict"; function query(sel) { return document.querySelector(sel); } function queryAll(sel) { return [...document.querySelectorAll(sel)]; } function iter(obj) { if(!obj) return []; var it = obj[Symbol.iterator]; if(it) return it; return Object.entries(obj); } function mk(tagname, attrs, ...children) { const el = document.createElement(tagname); for(const [k,v] of iter(attrs)) { if(k.slice(0,3) == "_on") { const eventName = k.slice(3); el.addEventListener(eventName, v); } else if(k[0] == "_") { // property, not attribute el[k.slice(1)] = v; } else { if(v === false || v == null) { continue; } else if(v === true) { el.setAttribute(k, ""); continue; } else { el.setAttribute(k, v); } } } append(el, children); return el; } /* Create shortcuts for every known HTML element */ [ "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "nobr", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video", "wbr", "xmp", ].forEach(tagname=>{ mk[tagname] = (...args) => mk(tagname, ...args); }); function* nodesFromChildList(children) { for(const child of children.flat(Infinity)) { if(child instanceof Node) { yield child; } else { yield new Text(child); } } } function append(el, ...children) { for(const child of nodesFromChildList(children)) { if(el instanceof Node) el.appendChild(child); else el.push(child); } return el; } function insertAfter(el, ...children) { for(const child of nodesFromChildList(children)) { el.parentNode.insertBefore(child, el.nextSibling); } return el; } function clearContents(el) { el.innerHTML = ""; return el; } function parseHTML(markup) { if(markup.toLowerCase().trim().indexOf('<!doctype') === 0) { const doc = document.implementation.createHTMLDocument(""); doc.documentElement.innerHTML = markup; return doc; } else { const el = mk.template({}); el.innerHTML = markup; return el.content; } }</script> <script>/* Boilerplate: script-dfn-panel */ "use strict"; { let dfnPanelData = { "0570259e": {"dfnID":"0570259e","dfnText":"float","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-float"},{"id":"ref-for-propdef-float\u2460"}],"title":"2.3. \n\tTypes of footnotes\n"}],"url":"https://drafts.csswg.org/css2/#propdef-float"}, "1d798932": {"dfnID":"1d798932","dfnText":"<string>","external":true,"refSections":[{"refs":[{"id":"ref-for-string-value"},{"id":"ref-for-string-value\u2460"}],"title":"1.1.1. \n\tThe string-set property\n"}],"url":"https://www.w3.org/TR/css-values-4/#string-value"}, "4eb9d37e": {"dfnID":"4eb9d37e","dfnText":"|","external":true,"refSections":[{"refs":[{"id":"ref-for-comb-one"},{"id":"ref-for-comb-one\u2460"},{"id":"ref-for-comb-one\u2461"},{"id":"ref-for-comb-one\u2462"},{"id":"ref-for-comb-one\u2463"}],"title":"1.1.1. \n\tThe string-set property\n"},{"refs":[{"id":"ref-for-comb-one\u2464"},{"id":"ref-for-comb-one\u2465"},{"id":"ref-for-comb-one\u2466"}],"title":"1.1.1.1. The content() function"},{"refs":[{"id":"ref-for-comb-one\u2467"},{"id":"ref-for-comb-one\u2468"},{"id":"ref-for-comb-one\u2460\u24ea"}],"title":"1.2.2. \nThe element() value\n"},{"refs":[{"id":"ref-for-comb-one\u2460\u2460"},{"id":"ref-for-comb-one\u2460\u2461"}],"title":"2.3. \n\tTypes of footnotes\n"},{"refs":[{"id":"ref-for-comb-one\u2460\u2462"},{"id":"ref-for-comb-one\u2460\u2463"}],"title":"2.8. \nRendering footnotes and footnote policy\n"}],"url":"https://www.w3.org/TR/css-values-4/#comb-one"}, "598f7b8c": {"dfnID":"598f7b8c","dfnText":"counter()","external":true,"refSections":[{"refs":[{"id":"ref-for-funcdef-counter"},{"id":"ref-for-funcdef-counter\u2460"}],"title":"1.1.1. \n\tThe string-set property\n"}],"url":"https://www.w3.org/TR/css-lists-3/#funcdef-counter"}, "7e7c0df8": {"dfnID":"7e7c0df8","dfnText":"bookmark-level","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-bookmark-level"}],"title":"Appendix C: Changes"}],"url":"https://www.w3.org/TR/css-content-3/#propdef-bookmark-level"}, "8a110a7b": {"dfnID":"8a110a7b","dfnText":"CSS-wide keywords","external":true,"refSections":[{"refs":[{"id":"ref-for-css-wide-keywords"}],"title":"\nValue Definitions"}],"url":"https://www.w3.org/TR/css-values-4/#css-wide-keywords"}, "8cd4f032": {"dfnID":"8cd4f032","dfnText":",","external":true,"refSections":[{"refs":[{"id":"ref-for-comb-comma"}],"title":"1.2.2. \nThe element() value\n"}],"url":"https://www.w3.org/TR/css-values-4/#comb-comma"}, "a0144f62": {"dfnID":"a0144f62","dfnText":"<custom-ident>","external":true,"refSections":[{"refs":[{"id":"ref-for-identifier-value"}],"title":"1.1.1. \n\tThe string-set property\n"},{"refs":[{"id":"ref-for-identifier-value\u2460"},{"id":"ref-for-identifier-value\u2461"}],"title":"1.2.1. \nThe running() value\n"},{"refs":[{"id":"ref-for-identifier-value\u2462"}],"title":"1.2.2. \nThe element() value\n"},{"refs":[{"id":"ref-for-identifier-value\u2463"}],"title":"3.1. \nPage Selectors\n"}],"url":"https://www.w3.org/TR/css-values-4/#identifier-value"}, "a20cee51": {"dfnID":"a20cee51","dfnText":"attr()","external":true,"refSections":[{"refs":[{"id":"ref-for-funcdef-attr"},{"id":"ref-for-funcdef-attr\u2460"},{"id":"ref-for-funcdef-attr\u2461"}],"title":"1.1.1. \n\tThe string-set property\n"}],"url":"https://www.w3.org/TR/css-values-5/#funcdef-attr"}, "a3e443ae": {"dfnID":"a3e443ae","dfnText":"counters()","external":true,"refSections":[{"refs":[{"id":"ref-for-funcdef-counters"},{"id":"ref-for-funcdef-counters\u2460"}],"title":"1.1.1. \n\tThe string-set property\n"}],"url":"https://www.w3.org/TR/css-lists-3/#funcdef-counters"}, "af4a190d": {"dfnID":"af4a190d","dfnText":"+","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-one-plus"}],"title":"1.1.1. \n\tThe string-set property\n"}],"url":"https://www.w3.org/TR/css-values-4/#mult-one-plus"}, "b246dfdc": {"dfnID":"b246dfdc","dfnText":"bookmark-label","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-bookmark-label"}],"title":"Appendix C: Changes"}],"url":"https://www.w3.org/TR/css-content-3/#propdef-bookmark-label"}, "b2862018": {"dfnID":"b2862018","dfnText":"<an+b>","external":true,"refSections":[{"refs":[{"id":"ref-for-anb-production"}],"title":"3.1. \nPage Selectors\n"}],"url":"https://www.w3.org/TR/css-syntax-3/#anb-production"}, "c297b070": {"dfnID":"c297b070","dfnText":"#","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-comma"}],"title":"1.1.1. \n\tThe string-set property\n"}],"url":"https://www.w3.org/TR/css-values-4/#mult-comma"}, "ce1025d0": {"dfnID":"ce1025d0","dfnText":"page","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-page"}],"title":"3.2. \nPage groups\n"}],"url":"https://www.w3.org/TR/css-page-3/#propdef-page"}, "content-list": {"dfnID":"content-list","dfnText":"<content-list>","external":false,"refSections":[{"refs":[{"id":"ref-for-content-list"},{"id":"ref-for-content-list\u2460"},{"id":"ref-for-content-list\u2461"}],"title":"1.1.1. \n\tThe string-set property\n"}],"url":"#content-list"}, "d4441b24": {"dfnID":"d4441b24","dfnText":"?","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-opt"}],"title":"1.2.2. \nThe element() value\n"},{"refs":[{"id":"ref-for-mult-opt\u2460"}],"title":"3.1. \nPage Selectors\n"}],"url":"https://www.w3.org/TR/css-values-4/#mult-opt"}, "dc76e65c": {"dfnID":"dc76e65c","dfnText":"position","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-position"}],"title":"1.2.1. \nThe running() value\n"}],"url":"https://www.w3.org/TR/CSS21/visuren.html#propdef-position"}, "ecfae07b": {"dfnID":"ecfae07b","dfnText":"string()","external":true,"refSections":[{"refs":[{"id":"ref-for-funcdef-string"},{"id":"ref-for-funcdef-string\u2460"}],"title":"1.1. \n\tNamed strings\n"},{"refs":[{"id":"ref-for-funcdef-string\u2461"}],"title":"1.1.1.1. The content() function"},{"refs":[{"id":"ref-for-funcdef-string\u2462"},{"id":"ref-for-funcdef-string\u2463"},{"id":"ref-for-funcdef-string\u2464"}],"title":"1.1.2. \n\tThe string() function\n"},{"refs":[{"id":"ref-for-funcdef-string\u2465"}],"title":"1.2.2. \nThe element() value\n"}],"url":"https://www.w3.org/TR/css-content-3/#funcdef-string"}, "entry-value": {"dfnID":"entry-value","dfnText":"entry value","external":false,"refSections":[],"url":"#entry-value"}, "exit-value": {"dfnID":"exit-value","dfnText":"exit value","external":false,"refSections":[],"url":"#exit-value"}, "f3e8378c": {"dfnID":"f3e8378c","dfnText":"content","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-content"}],"title":"1.1.2. \n\tThe string() function\n"},{"refs":[{"id":"ref-for-propdef-content\u2460"}],"title":"1.2.2. \nThe element() value\n"}],"url":"https://www.w3.org/TR/css-content-3/#propdef-content"}, "footnote-counter": {"dfnID":"footnote-counter","dfnText":"footnote counter","external":false,"refSections":[],"url":"#footnote-counter"}, "footnote-display-block": {"dfnID":"footnote-display-block","dfnText":"block","external":false,"refSections":[],"url":"#footnote-display-block"}, "footnote-display-compact": {"dfnID":"footnote-display-compact","dfnText":"compact","external":false,"refSections":[],"url":"#footnote-display-compact"}, "footnote-display-inline": {"dfnID":"footnote-display-inline","dfnText":"inline","external":false,"refSections":[],"url":"#footnote-display-inline"}, "footnote-policy-line": {"dfnID":"footnote-policy-line","dfnText":"line","external":false,"refSections":[{"refs":[{"id":"ref-for-footnote-policy-line"}],"title":"2.8. \nRendering footnotes and footnote policy\n"}],"url":"#footnote-policy-line"}, "funcdef-content": {"dfnID":"funcdef-content","dfnText":"content()","external":false,"refSections":[{"refs":[{"id":"ref-for-funcdef-content"},{"id":"ref-for-funcdef-content\u2460"},{"id":"ref-for-funcdef-content\u2461"}],"title":"1.1.1. \n\tThe string-set property\n"},{"refs":[{"id":"ref-for-funcdef-content\u2462"}],"title":"1.1.1.1. The content() function"}],"url":"#funcdef-content"}, "funcdef-element": {"dfnID":"funcdef-element","dfnText":"element()","external":false,"refSections":[{"refs":[{"id":"ref-for-funcdef-element"}],"title":"1.2. \n\tRunning elements\n"},{"refs":[{"id":"ref-for-funcdef-element\u2460"},{"id":"ref-for-funcdef-element\u2461"}],"title":"1.2.1. \nThe running() value\n"},{"refs":[{"id":"ref-for-funcdef-element\u2462"},{"id":"ref-for-funcdef-element\u2463"},{"id":"ref-for-funcdef-element\u2464"},{"id":"ref-for-funcdef-element\u2465"},{"id":"ref-for-funcdef-element\u2466"},{"id":"ref-for-funcdef-element\u2467"}],"title":"1.2.2. \nThe element() value\n"}],"url":"#funcdef-element"}, "funcdef-running": {"dfnID":"funcdef-running","dfnText":"running()","external":false,"refSections":[{"refs":[{"id":"ref-for-funcdef-running"}],"title":"1.2. \n\tRunning elements\n"},{"refs":[{"id":"ref-for-funcdef-running\u2460"},{"id":"ref-for-funcdef-running\u2461"}],"title":"1.2.1. \nThe running() value\n"},{"refs":[{"id":"ref-for-funcdef-running\u2462"}],"title":"1.2.2. \nThe element() value\n"}],"url":"#funcdef-running"}, "named-string": {"dfnID":"named-string","dfnText":"Named strings","external":false,"refSections":[],"url":"#named-string"}, "page-group": {"dfnID":"page-group","dfnText":"page group","external":false,"refSections":[],"url":"#page-group"}, "page-selectors": {"dfnID":"page-selectors","dfnText":"page selectors","external":false,"refSections":[],"url":"#page-selectors"}, "propdef-footnote-display": {"dfnID":"propdef-footnote-display","dfnText":"footnote-display","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-footnote-display"}],"title":"2.3. \n\tTypes of footnotes\n"},{"refs":[{"id":"ref-for-propdef-footnote-display\u2460"},{"id":"ref-for-propdef-footnote-display\u2461"}],"title":"Appendix C: Changes"}],"url":"#propdef-footnote-display"}, "propdef-footnote-policy": {"dfnID":"propdef-footnote-policy","dfnText":"footnote-policy","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-footnote-policy"}],"title":"2.8. \nRendering footnotes and footnote policy\n"},{"refs":[{"id":"ref-for-propdef-footnote-policy\u2460"},{"id":"ref-for-propdef-footnote-policy\u2461"}],"title":"Appendix C: Changes"}],"url":"#propdef-footnote-policy"}, "propdef-running": {"dfnID":"propdef-running","dfnText":"running","external":false,"refSections":[],"url":"#propdef-running"}, "propdef-string-set": {"dfnID":"propdef-string-set","dfnText":"string-set","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-string-set"}],"title":"1.1. \n\tNamed strings\n"},{"refs":[{"id":"ref-for-propdef-string-set\u2460"}],"title":"1.1.1. \n\tThe string-set property\n"},{"refs":[{"id":"ref-for-propdef-string-set\u2461"},{"id":"ref-for-propdef-string-set\u2462"}],"title":"Appendix C: Changes"}],"url":"#propdef-string-set"}, "running-elements0": {"dfnID":"running-elements0","dfnText":"Running elements","external":false,"refSections":[],"url":"#running-elements0"}, "selectordef-nth": {"dfnID":"selectordef-nth","dfnText":":nth()","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-nth"},{"id":"ref-for-selectordef-nth\u2460"},{"id":"ref-for-selectordef-nth\u2461"},{"id":"ref-for-selectordef-nth\u2462"}],"title":"3.1. \nPage Selectors\n"}],"url":"#selectordef-nth"}, "valdef-float-footnote": {"dfnID":"valdef-float-footnote","dfnText":"footnote","external":false,"refSections":[],"url":"#valdef-float-footnote"}, "valdef-footnote-policy-auto": {"dfnID":"valdef-footnote-policy-auto","dfnText":"auto","external":false,"refSections":[],"url":"#valdef-footnote-policy-auto"}, "valdef-footnote-policy-block": {"dfnID":"valdef-footnote-policy-block","dfnText":"block","external":false,"refSections":[],"url":"#valdef-footnote-policy-block"}, }; document.addEventListener("DOMContentLoaded", ()=>{ genAllDfnPanels(); document.body.addEventListener("click", (e) => { // If not handled already, just hide all dfn panels. hideAllDfnPanels(); }); }); window.addEventListener("resize", () => { // Pin any visible dfn panel queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(el=>positionDfnPanel(el)); }); function genAllDfnPanels() { for(const panelData of Object.values(dfnPanelData)) { const dfnID = panelData.dfnID; const dfn = document.getElementById(dfnID); if(!dfn) { console.log(`Can't find dfn#${dfnID}.`, panelData); continue; } dfn.panelData = panelData; insertDfnPopupAction(dfn); } } function genDfnPanel(dfn, { dfnID, url, dfnText, refSections, external }) { const dfnPanel = mk.aside({ class: "dfn-panel on", id: `infopanel-for-${dfnID}`, "data-for": dfnID, "aria-labelled-by":`infopaneltitle-for-${dfnID}`, }, mk.span({id:`infopaneltitle-for-${dfnID}`, style:"display:none"}, `Info about the '${dfnText}' ${external?"external":""} reference.`), mk.a({href:url, class:"dfn-link"}, url), refSections.length == 0 ? [] : mk.b({}, "Referenced in:"), mk.ul({}, ...refSections.map(section=> mk.li({}, ...section.refs.map((ref, refI)=> [ mk.a({ href: `#${ref.id}` }, (refI == 0) ? section.title : `(${refI + 1})` ), " ", ] ), ), ), ), genLinkingSyntaxes(dfn), ); dfnPanel.addEventListener('click', (event) => { if (event.target.nodeName == 'A') { scrollToTargetAndHighlight(event); pinDfnPanel(dfnPanel); } event.stopPropagation(); refocusOnTarget(event); }); dfnPanel.addEventListener('keydown', (event) => { if(event.keyCode == 27) { // Escape key hideDfnPanel({dfnPanel}); event.stopPropagation(); event.preventDefault(); } }); dfnPanel.dfn = dfn; dfn.dfnPanel = dfnPanel; return dfnPanel; } function hideAllDfnPanels() { // Delete the currently-active dfn panel. queryAll(".dfn-panel").forEach(dfnPanel=>hideDfnPanel({dfnPanel})); } function showDfnPanel(dfn) { hideAllDfnPanels(); // Only display one at a time. dfn.setAttribute("aria-expanded", "true"); const dfnPanel = genDfnPanel(dfn, dfn.panelData); // Give the dfn a unique tabindex, and then // give all the tabbable panel bits successive indexes. let tabIndex = 100; dfn.tabIndex = tabIndex++; const tabbable = dfnPanel.querySelectorAll(":is(a, button)"); for (const el of tabbable) { el.tabIndex = tabIndex++; } append(document.body, dfnPanel); positionDfnPanel(dfnPanel); } function positionDfnPanel(dfnPanel) { const dfn = dfnPanel.dfn; const dfnPos = getBounds(dfn); dfnPanel.style.top = dfnPos.bottom + "px"; dfnPanel.style.left = dfnPos.left + "px"; const panelPos = dfnPanel.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, dfnPos.left - overflowAmount); dfnPanel.style.left = newLeft + "px"; } } function pinDfnPanel(dfnPanel) { // Switch it to "activated" state, which pins it. dfnPanel.classList.add("activated"); dfnPanel.style.position = "fixed"; dfnPanel.style.left = null; dfnPanel.style.top = null; } function hideDfnPanel({dfn, dfnPanel}) { if(!dfnPanel) dfnPanel = dfn.dfnPanel; if(!dfn) dfn = dfnPanel.dfn; dfn.dfnPanel = undefined; dfnPanel.dfn = undefined; dfn.setAttribute("aria-expanded", "false"); dfn.tabIndex = undefined; dfnPanel.remove() } function toggleDfnPanel(dfn) { if(dfn.dfnPanel) { hideDfnPanel(dfn); } else { showDfnPanel(dfn); } } function insertDfnPopupAction(dfn) { dfn.setAttribute('role', 'button'); dfn.setAttribute('aria-expanded', 'false') dfn.tabIndex = 0; dfn.classList.add('has-dfn-panel'); dfn.addEventListener('click', (event) => { toggleDfnPanel(dfn); event.stopPropagation(); }); dfn.addEventListener('keypress', (event) => { const kc = event.keyCode; // 32->Space, 13->Enter if(kc == 32 || kc == 13) { toggleDfnPanel(dfn); event.stopPropagation(); event.preventDefault(); } }); } function refocusOnTarget(event) { const target = event.target; setTimeout(() => { // Refocus on the event.target element. // This is needed after browser scrolls to the destination. target.focus(); }); } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function scrollToTargetAndHighlight(event) { let hash = event.target.hash; if (hash) { hash = decodeURIComponent(hash.substring(1)); const dest = document.getElementById(hash); if (dest) { dest.classList.add('highlighted'); setTimeout(() => dest.classList.remove('highlighted'), 1000); } } } // Functions, divided by link type, that wrap an autolink's // contents with the appropriate outer syntax. // Alternately, a string naming another type they format // the same as. function needsFor(type) { switch(type) { case "descriptor": case "value": case "element-attr": case "attr-value": case "element-state": case "method": case "constructor": case "argument": case "attribute": case "const": case "dict-member": case "event": case "enum-value": case "stringifier": case "serializer": case "iterator": case "maplike": case "setlike": case "state": case "mode": case "context": case "facet": return true; default: return false; } } function refusesFor(type) { switch(type) { case "property": case "element": case "interface": case "namespace": case "callback": case "dictionary": case "enum": case "exception": case "typedef": case "http-header": case "permission": return true; default: return false; } } function linkFormatterFromType(type) { switch(type) { case 'scheme': case 'permission': case 'dfn': return (text) => `[=${text}=]`; case 'abstract-op': return (text) => `[\$${text}\$]`; case 'function': case 'at-rule': case 'selector': case 'value': return (text) => `''${text}''`; case 'http-header': return (text) => `[:${text}:]`; case 'interface': case 'constructor': case 'method': case 'argument': case 'attribute': case 'callback': case 'dictionary': case 'dict-member': case 'enum': case 'enum-value': case 'exception': case 'const': case 'typedef': case 'stringifier': case 'serializer': case 'iterator': case 'maplike': case 'setlike': case 'extended-attribute': case 'event': case 'idl': return (text) => `{{${text}}}`; case 'element-state': case 'element-attr': case 'attr-value': case 'element': return (element) => `<{${element}}>`; case 'grammar': return (text) => `${text} (within a <pre class=prod>)`; case 'type': return (text)=> `<<${text}>>`; case 'descriptor': case 'property': return (text) => `'${text}'`; default: return; }; }; function genLinkingSyntaxes(dfn) { if(dfn.tagName != "DFN") return; const type = dfn.getAttribute('data-dfn-type'); if(!type) { console.log(`<dfn> doesn't have a data-dfn-type:`, dfn); return []; } // Return a function that wraps link text based on the type const linkFormatter = linkFormatterFromType(type); if(!linkFormatter) { console.log(`<dfn> has an unknown data-dfn-type:`, dfn); return []; } let ltAlts; if(dfn.hasAttribute('data-lt')) { ltAlts = dfn.getAttribute('data-lt') .split("|") .map(x=>x.trim()); } else { ltAlts = [dfn.textContent.trim()]; } if(type == "type") { // lt of "<foo>", but "foo" is the interior; // <<foo/bar>> is how you write it with a for, // not <foo/<bar>> or whatever. for(var i = 0; i < ltAlts.length; i++) { const lt = ltAlts[i]; const match = /<(.*)>/.exec(lt); if(match) { ltAlts[i] = match[1]; } } } let forAlts; if(dfn.hasAttribute('data-dfn-for')) { forAlts = dfn.getAttribute('data-dfn-for') .split(",") .map(x=>x.trim()); } else { forAlts = ['']; } let linkingSyntaxes = []; if(!needsFor(type)) { for(const lt of ltAlts) { linkingSyntaxes.push(linkFormatter(lt)); } } if(!refusesFor(type)) { for(const f of forAlts) { linkingSyntaxes.push(linkFormatter(`${f}/${ltAlts[0]}`)) } } return [ mk.b({}, 'Possible linking syntaxes:'), mk.ul({}, ...linkingSyntaxes.map(link => { const copyLink = async () => await navigator.clipboard.writeText(link); return mk.li({}, mk.div({ class: 'link-item' }, mk.button({ class: 'copy-icon', title: 'Copy', type: 'button', _onclick: copyLink, tabindex: 0, }, mk.span({ class: 'icon' }) ), mk.span({}, link) ) ); }) ) ]; } } </script> <script>/* Boilerplate: script-link-titles */ "use strict"; { let linkTitleData = { "#content-list": "Expands to: attr() | close-quote | contents | leader() | no-close-quote | no-open-quote | open-quote", }; function setTypeTitles() { for(let el of document.querySelectorAll("a[href]")) { if(el.href in linkTitleData && !el.hasAttribute("title")) { el.setAttribute("title", linkTitleData[el.href]); } } } document.addEventListener("DOMContentLoaded", setTypeTitles); } </script> <script>/* Boilerplate: script-ref-hints */ "use strict"; { let refsData = { "#content-list": {"displayText":"<content-list>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"<content-list>","type":"type","url":"#content-list"}, "#funcdef-content": {"displayText":"content()","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"content()","type":"function","url":"#funcdef-content"}, "#funcdef-element": {"displayText":"element()","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"element()","type":"function","url":"#funcdef-element"}, "#funcdef-running": {"displayText":"running()","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"running()","type":"function","url":"#funcdef-running"}, "#propdef-footnote-display": {"displayText":"footnote-display","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"footnote-display","type":"property","url":"#propdef-footnote-display"}, "#propdef-footnote-policy": {"displayText":"footnote-policy","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"footnote-policy","type":"property","url":"#propdef-footnote-policy"}, "#propdef-running": {"displayText":"running","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"running","type":"property","url":"#propdef-running"}, "#propdef-string-set": {"displayText":"string-set","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":"string-set","type":"property","url":"#propdef-string-set"}, "#selectordef-nth": {"displayText":":nth()","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-gcpm","spec":"css-gcpm-3","status":"local","text":":nth()","type":"selector","url":"#selectordef-nth"}, "https://drafts.csswg.org/css2/#propdef-float": {"displayText":"float","export":true,"for_":[],"level":"1","normative":true,"shortname":"css","spec":"css22","status":"current","text":"float","type":"property","url":"https://drafts.csswg.org/css2/#propdef-float"}, "https://www.w3.org/TR/CSS21/visuren.html#propdef-position": {"displayText":"position","export":true,"for_":[],"level":"1","normative":true,"shortname":"css","spec":"css21","status":"snapshot","text":"position","type":"property","url":"https://www.w3.org/TR/CSS21/visuren.html#propdef-position"}, "https://www.w3.org/TR/css-content-3/#funcdef-string": {"displayText":"string()","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-content","spec":"css-content-3","status":"snapshot","text":"string()","type":"function","url":"https://www.w3.org/TR/css-content-3/#funcdef-string"}, "https://www.w3.org/TR/css-content-3/#propdef-bookmark-label": {"displayText":"bookmark-label","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-content","spec":"css-content-3","status":"snapshot","text":"bookmark-label","type":"property","url":"https://www.w3.org/TR/css-content-3/#propdef-bookmark-label"}, "https://www.w3.org/TR/css-content-3/#propdef-bookmark-level": {"displayText":"bookmark-level","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-content","spec":"css-content-3","status":"snapshot","text":"bookmark-level","type":"property","url":"https://www.w3.org/TR/css-content-3/#propdef-bookmark-level"}, "https://www.w3.org/TR/css-content-3/#propdef-content": {"displayText":"content","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-content","spec":"css-content-3","status":"snapshot","text":"content","type":"property","url":"https://www.w3.org/TR/css-content-3/#propdef-content"}, "https://www.w3.org/TR/css-lists-3/#funcdef-counter": {"displayText":"counter()","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-lists","spec":"css-lists-3","status":"snapshot","text":"counter()","type":"function","url":"https://www.w3.org/TR/css-lists-3/#funcdef-counter"}, "https://www.w3.org/TR/css-lists-3/#funcdef-counters": {"displayText":"counters()","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-lists","spec":"css-lists-3","status":"snapshot","text":"counters()","type":"function","url":"https://www.w3.org/TR/css-lists-3/#funcdef-counters"}, "https://www.w3.org/TR/css-page-3/#propdef-page": {"displayText":"page","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-page","spec":"css-page-3","status":"snapshot","text":"page","type":"property","url":"https://www.w3.org/TR/css-page-3/#propdef-page"}, "https://www.w3.org/TR/css-syntax-3/#anb-production": {"displayText":"<an+b>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"snapshot","text":"<an+b>","type":"type","url":"https://www.w3.org/TR/css-syntax-3/#anb-production"}, "https://www.w3.org/TR/css-values-4/#comb-comma": {"displayText":",","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":",","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#comb-comma"}, "https://www.w3.org/TR/css-values-4/#comb-one": {"displayText":"|","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"|","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#comb-one"}, "https://www.w3.org/TR/css-values-4/#css-wide-keywords": {"displayText":"CSS-wide keywords","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"css-wide keywords","type":"dfn","url":"https://www.w3.org/TR/css-values-4/#css-wide-keywords"}, "https://www.w3.org/TR/css-values-4/#identifier-value": {"displayText":"<custom-ident>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"<custom-ident>","type":"type","url":"https://www.w3.org/TR/css-values-4/#identifier-value"}, "https://www.w3.org/TR/css-values-4/#mult-comma": {"displayText":"#","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"#","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#mult-comma"}, "https://www.w3.org/TR/css-values-4/#mult-one-plus": {"displayText":"+","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"+","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#mult-one-plus"}, "https://www.w3.org/TR/css-values-4/#mult-opt": {"displayText":"?","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"?","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#mult-opt"}, "https://www.w3.org/TR/css-values-4/#string-value": {"displayText":"<string>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"<string>","type":"type","url":"https://www.w3.org/TR/css-values-4/#string-value"}, "https://www.w3.org/TR/css-values-5/#funcdef-attr": {"displayText":"attr()","export":true,"for_":[],"level":"5","normative":true,"shortname":"css-values","spec":"css-values-5","status":"snapshot","text":"attr()","type":"function","url":"https://www.w3.org/TR/css-values-5/#funcdef-attr"}, }; function mkRefHint(link, ref) { const linkText = link.textContent; let dfnTextElements = ''; if (ref.displayText.toLowerCase() != linkText.toLowerCase()) { // Give the original term if it's being displayed in a different way. // But allow casing differences, they're insignificant. dfnTextElements = mk.li({}, mk.b({}, "Term: "), mk.span({}, ref.displayText) ); } const forList = ref.for_; let forListElements; if(forList.length == 0) { forListElements = []; } else if(forList.length == 1) { forListElements = mk.li({}, mk.b({}, "For: "), mk.span({}, forList[0]), ); } else { forListElements = mk.li({}, mk.b({}, "For: "), mk.ul({}, ...forList.map(forItem => mk.li({}, mk.span({}, forItem) ), ), ), ); } const url = ref.url; const safeUrl = encodeURIComponent(url); const hintPanel = mk.aside({ class: "ref-hint", id: `ref-hint-for-${safeUrl}`, "data-for": url, "aria-labelled-by": `ref-hint-for-${safeUrl}`, }, mk.ul({}, dfnTextElements, mk.li({}, mk.b({}, "URL: "), mk.a({ href: url, class: "ref" }, url), ), mk.li({}, mk.b({}, "Type: "), mk.span({}, `${ref.type}`), ), mk.li({}, mk.b({}, "Spec: "), mk.span({}, `${ref.spec ? ref.spec : ''}`), ), forListElements ), ); hintPanel.forLink = link; setupRefHintEventListeners(link, hintPanel); return hintPanel; } function hideAllRefHints() { queryAll(".ref-hint").forEach(el=>hideRefHint(el)); } function hideRefHint(refHint) { const link = refHint.forLink; link.setAttribute("aria-expanded", "false"); if(refHint.teardownEventListeners) { refHint.teardownEventListeners(); } refHint.remove(); } function showRefHint(link) { if(link.classList.contains("dfn-link")) return; const url = link.getAttribute("href"); const ref = refsData[url]; if(!ref) return; hideAllRefHints(); // Only display one at this time. const refHint = mkRefHint(link, ref); append(document.body, refHint); link.setAttribute("aria-expanded", "true"); positionRefHint(refHint); } function setupRefHintEventListeners(link, refHint) { if (refHint.teardownEventListeners) return; // Add event handlers to hide the refHint after the user moves away // from both the link and refHint, if not hovering either within one second. let timeout = null; const startHidingRefHint = (event) => { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(() => { hideRefHint(refHint); }, 1000); } const resetHidingRefHint = (event) => { if (timeout) clearTimeout(timeout); timeout = null; }; link.addEventListener("mouseleave", startHidingRefHint); link.addEventListener("mouseenter", resetHidingRefHint); link.addEventListener("blur", startHidingRefHint); link.addEventListener("focus", resetHidingRefHint); refHint.addEventListener("mouseleave", startHidingRefHint); refHint.addEventListener("mouseenter", resetHidingRefHint); refHint.addEventListener("blur", startHidingRefHint); refHint.addEventListener("focus", resetHidingRefHint); refHint.teardownEventListeners = () => { // remove event listeners resetHidingRefHint(); link.removeEventListener("mouseleave", startHidingRefHint); link.removeEventListener("mouseenter", resetHidingRefHint); link.removeEventListener("blur", startHidingRefHint); link.removeEventListener("focus", resetHidingRefHint); refHint.removeEventListener("mouseleave", startHidingRefHint); refHint.removeEventListener("mouseenter", resetHidingRefHint); refHint.removeEventListener("blur", startHidingRefHint); refHint.removeEventListener("focus", resetHidingRefHint); }; } function positionRefHint(refHint) { const link = refHint.forLink; const linkPos = getBounds(link); refHint.style.top = linkPos.bottom + "px"; refHint.style.left = linkPos.left + "px"; const panelPos = refHint.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, linkPos.left - overflowAmount); refHint.style.left = newLeft + "px"; } } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function showRefHintListener(e) { // If the target isn't in a link (or is a link), // just ignore it. let link = e.target.closest("a"); if(!link) return; // If the target is in a ref-hint panel // (aka a link in the already-open one), // also just ignore it. if(link.closest(".ref-hint")) return; // Otherwise, show the panel for the link. showRefHint(link); } function hideAllHintsListener(e) { // If the click is inside a ref-hint panel, ignore it. if(e.target.closest(".ref-hint")) return; // Otherwise, close all the current panels. hideAllRefHints(); } document.addEventListener("DOMContentLoaded", () => { document.body.addEventListener("mousedown", showRefHintListener); document.body.addEventListener("focus", showRefHintListener); document.body.addEventListener("click", hideAllHintsListener); }); window.addEventListener("resize", () => { // Hide any open ref hint. hideAllRefHints(); }); } </script>

Pages: 1 2 3 4 5 6 7 8 9 10