10BC0 csswg-drafts/css-gcpm/Overview.html at 0daa56a1254df15b9ec148ca778a722c9deb018e · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
executable file
·
4835 lines (3702 loc) · 132 KB

File metadata and controls

executable file
·
4835 lines (3702 loc) · 132 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head profile="http://dublincore.org/documents/2008/08/04/dc-html/ ">
<title>CSS Generated Content for Paged Media Module</title>
<link href="http://purl.org/dc/terms/" rel=schema.dcterms>
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=dcterms.rights>
<meta content="CSS Generated Content for Paged Media Module"
name=dcterms.title>
<meta content=text name=dcterms.type>
<meta content=2013-07-24 name=dcterms.date>
<meta content="Håkon Wium Lie" name=dcterms.creator>
<meta content=W3C name=dcterms.publisher>
<meta content="http://dev.w3.org/csswg/css3-gcpm/" name=dcterms.identifier>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<style type="text/css">
.example img { display: block }
.example { background: #ddd }
body { line-height: 1.3 }
.unimplemented { background: #fdd }
table.string-set-example { font-family: monospace; border-collapse: collapse }
table.string-set-example div.pre {
width: 12em; white-space: pre;
}
table.string-set-example td {
padding: 0.3em;
border: thin solid black
}
</style>
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Generated Content for Paged Media Module</h1>
8E71 <h2 class="no-num no-toc" id=w3c-working>Editor's Draft 24 July 2013</h2>
<dl>
<dt>This version:
<dd><a
href="http://dev.w3.org/csswg/css3-gcpm/">http://www.w3.org/TR/2013/ED-css3-gcpm-20130724/</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-gcpm/">http://www.w3.org/TR/css3-gcpm/</a>
<dt>Previous version:
<dd><a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/">
http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/</a>
<dt>Feedback:
<dd><a
href="mailto:www-style@w3.org?subject=%5Bcss-gcpm%5D%20feedback">www-style@w3.org</a>
with subject line “<kbd>[css-gcpm] <var>… message topic
…</var></kbd>” (<a
href="http://lists.w3.org/Archives/Public/www-style/"
rel=discussion>archives</a>)
<dt>Editor:
<dd>Håkon Wium Lie, Opera Software, howcome@opera.com
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><abbr
title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
href="http://www.ercim.eu/"><abbr
title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>, <a
href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>This module describes features often used in printed publications. Most
of the specified functionality involves some sort of generated content
where content from the document is adorned, replicated, or moved in the
final presentation of the document. Along with two other CSS3 modules –
multi-column layout and paged media – this module offers advanced
functionality for presenting structured documents on paged media. Paged
media can be printed, or presented on screens.
<h2 class="no-num no-toc" id=status-of-this-document>Status of this
document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-gcpm%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
discussion of this specification. When sending e-mail, please put the text
“css3-gcpm” in the subject, preferably like this:
“[<!---->css3-gcpm<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a
href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
the <a href="http://www.w3.org/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
2004 W3C Patent Policy</a>. W3C maintains a <a
href="http://www.w3.org/2004/01/pp-impl/32061/status"
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="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</a>.</p>
<!--end-status-->
<p>This WD contains functionality that the CSS WG finds interesting and
useful. In general, the earlier a feature appears in this draft, the more
stable it is. Significant changes in functionality and syntax must be
expected from <a href="#paged-presentations">paged presentations</a> and
onwards. Also, functionality described in this module may be moved to
other modules. Since the <a
href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608">previous WD</a>,
hyphenation has been moved to <a
href="http://www.w3.org/TR/2011/WD-css3-text-20110901/#hyphenation">css3-text</a>
and the <a
href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#the-super-decimal-list-style-type">super-decimal</a>
list-style-type value has been moved to <a
href="http://www.w3.org/TR/2011/WD-css3-lists-20110524/#super-decimal">css3-lists</a>.
<a
href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#named-counter-styles">Named
counter styles</a> and the <a
href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#the-symbols-list-style-type">symbols()</a>
list-style-type value should also appear in a future css3-lists WD.
<h2 class="no-num no-toc" id=table-of-contents><a name=contents>Table of
contents</a></h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#introduction"><span class=secno>1. </span>Introduction</a>
<li><a href="#running-headers-and-footers"><span class=secno>2.
</span>Running headers and footers</a>
<ul class=toc>
<li><a href="#named-strings"><span class=secno>2.1. </span>Named
strings</a>
<ul class=toc>
<li><a href="#setting-named-strings-the-string-set-pro"><span
class=secn 7D4F o>2.1.1. </span>Setting named strings: the ‘<code
class=property>string-set</code>’ property</a>
<li><a href="#using-named-strings"><span class=secno>2.1.2.
</span>Using named strings</a>
</ul>
<li><a href="#running-elements"><span class=secno>2.2. </span>Running
elements</a>
</ul>
<li><a href="#leaders"><span class=secno>3. </span>Leaders</a>
<li><a href="#cross-references"><span class=secno>4.
</span>Cross-references</a>
<ul class=toc>
<li><a href="#the-target-counter-and-target-counters-v"><span
class=secno>4.1. </span>The ‘<code class=css>target-counter</code>’
and ‘<code class=css>target-counters</code>’ values</a>
<li><a href="#the-target-text-value"><span class=secno>4.2. </span>The
‘<code class=css>target-text</code>’ value</a>
</ul>
<li><a href="#footnotes"><span class=secno>5. </span>Footnotes</a>
<ul class=toc>
<li><a href="#turning-elements-into-footnotes"><span class=secno>5.1.
</span>Turning elements into footnotes</a>
<li><a href="#the-footnote-area"><span class=secno>5.2. </span>The
footnote area</a>
<li><a href="#footnote-calls"><span class=secno>5.3. </span>Footnote
calls</a>
<li><a href="#footnote-markers"><span class=secno>5.4. </span>Footnote
markers</a>
<li><a href="#counting-footnotes"><span class=secno>5.5. </span>Counting
footnotes</a>
<li><a href="#laying-out-footnotes"><span class=secno>5.6. </span>Laying
out footnotes</a>
<li><a href="#footnote-magic"><span class=secno>5.7. </span>Footnote
magic</a>
</ul>
<li><a href="#page-marks-and-bleed-area"><span class=secno>6. </span>Page
marks and bleed area</a>
<li><a href="#bookmarks"><span class=secno>7. </span>Bookmarks</a>
<ul class=toc>
<li><a href="#bookmark-level"><span class=secno>7.1. </span>‘<code
class=property>bookmark-level</code>’</a>
<li><a href="#bookmark-label"><span class=secno>7.2. </span>‘<code
class=property>bookmark-label</code>’</a>
<li><a href="#bookmark-state"><span class=secno>7.3. </span>‘<code
class=property>bookmark-state</code>’</a>
</ul>
<li><a href="#cmyk-colors"><span class=secno>8. </span>CMYK colors</a>
<li><a href="#styling-blank-pages"><span class=secno>9. </span>Styling
blank pages</a>
<li><a href="#paged-presentations"><span class=secno>10. </span>Paged
presentations</a>
<li><a href="#spatial-layout-of-pages-atlayout"><span class=secno>11.
</span>Spatial layout of pages; @layout</a>
<ul class=toc>
<li><a href="#page-shift-effects"><span class=secno>11.1. </span>Page
shift effects</a>
</ul>
<li><a href="#page-floats"><span class=secno>12. </span>Page floats</a>
<ul class=toc>
<li><a href="#floating-to-the-topbottom-top-bottom-sna"><span
class=secno>12.1. </span>Floating to the top/bottom: top, bottom,
snap</a>
<li><a href="#spanning-columns"><span class=secno>12.2. </span>Spanning
columns</a>
<li><a href="#deferring-floats-float-defer-column-floa"><span
class=secno>12.3. </span>Deferring floats: float-defer-column,
float-defer-page</a>
<ul class=toc>
<li><a href="#float-defer-column"><span class=secno>12.3.1.
</span>‘<code class=property>float-defer-column</code>’</a>
<li><a href="#float-defer-page"><span class=secno>12.3.2.
</span>‘<code class=property>float-defer-page</code>’</a>
</ul>
<li><a href="#clearing-page-floats"><span class=secno>12.4.
</span>Clearing page floats</a>
<li><a href="#overconstrained-page-floats"><span class=secno>12.5.
</span>Overconstrained page floats</a>
<li><a href="#floating-inside-and-outside-pages"><span class=secno>12.6.
</span>Floating inside and outside pages</a>
</ul>
<li><a href="#page-and-column-floats-alternative-synta"><span
class=secno>13. </span>Page and column floats, alternative syntax</a>
<li><a href="#exclusions"><span class=secno>14. </span>Exclusions</a>
<ul class=toc>
<li><a href="#exclusions-based-on-floats"><span class=secno>14.1.
</span>Exclusions based on floats</a>
<li><a href="#the-float-offset-property"><span class=secno>14.2.
</span>The ‘<code c 8E71 lass=property>float-offset</code>’ property</a>
<li><a href="#the-clear-side-property"><span class=secno>14.3.
</span>The ‘<code class=property>clear-side</code>’ property</a>
<li><a href="#exclusions-based-on-images"><span class=secno>14.4.
</span>Exclusions based on images</a>
<li><a href="#exclusions-based-on-rendered-content"><span
class=secno>14.5. </span>Exclusions based on rendered content</a>
<li><a href="#exclusions-based-on-shapes"><span class=secno>14.6.
</span>Exclusions based on shapes</a>
</ul>
<li><a href="#regions"><span class=secno>15. </span>Regions</a>
<li><a href="#regions-and-exclusions-examples"><span class=secno>16.
</span>Regions and Exclusions examples</a>
<li><a href="#selecting-pages"><span class=secno>17. </span>Selecting
pages</a>
<li><a href="#selecting-lines"><span class=secno>18. </span>Selecting
lines</a>
<li><a href="#conditional-text"><span class=secno>19. </span>Conditional
text</a>
<li><a href="#conformance"><span class=secno>20. </span>Conformance</a>
<li><a href="#appendix-a-default-style-sheet"><span class=secno>21.
</span>Appendix A: Default style sheet</a>
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
<li class=no-num><a href="#references">References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#other-references">Other references</a>
</ul>
<li class=no-num><a href="#index">Index</a>
<li class=no-num><a href="#property-index">Property index</a>
</ul>
<!--end-toc-->
<h2 id=introduction><span class=secno>1. </span>Introduction</h2>
<p>(This section is not normative.)
<p>This specification describes features often used in printed
publications. Some of the proposed functionality (e.g., the new list style
types, and border segments) may also used with other media types. However,
this specification is monstly concerned with paged media.
<h2 id=running-headers-and-footers><span class=secno>2. </span>Running
headers and footers</h2>
<p>To aid navigation in printed material, headers and footers are often
printed in the page margins. <a href="#CSS3PAGE"
rel=biblioentry>[CSS3PAGE]<!--{{CSS3PAGE}}--></a> describes how to place
headers and footers on a page, but not how to fetch headers and footers
from elements in the document. This specification offers two ways to
achieve this. The first mechanism is <dfn id=named-strings0>named
strings</dfn> which <em>copies</em> the text (without style, structure, or
replaced content) from one element for later reuse in margin boxes. The
second mechanism is <dfn id=running-elements0>running elements</dfn> which
<em>moves</em> elements (with style, structure, and replaced content) into
a margin box.
<h3 id=named-strings><span class=secno>2.1. </span>Named strings</h3>
<!--
<p>Named strings are discussed both in the CSS3 Generated and Replaced
Content (section 9) and in CSS3 Paged Media (several places). For a
proposed definition of the property, one has to go back to the <a href="http://www.w3.org/1999/06/WD-css3-page-19990623">CSS3 draft from 1999</a>
1999:
-->
<p>Named strings can be thought of as variables that can hold one string of
text each. Named strings are created with the ‘<a
href="#string-set"><code class=property>string-set</code></a>’ property
which copies a string of text into the named string. Only text is copied;
not style, structure, or replaced content.
<div class=example>
<p>Consider this code:
<pre>
h1 { string-set: title contents }
</pre>
<p>Whenever an <code>h1</code> element is encountered, its textual content
is copied into a named string called <em>title</em>. Its content can be
retrieved in the ‘<code class=property>content</code>’ property:
<pre>
@page :right { @top-right { content: string(title) }}
</pre>
</div>
<h4 id=setting-named-strings-the-string-set-pro><span class=secno>2.1.1.
</span>Setting named strings: the ‘<a href="#string-set"><code
class=property>string-set</code></a>’ property</h4>
<table class=propdef>
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=string-set>string-set</dfn>
<tr>
<td><em>Value:</em>
<td>[[ &lt;identifier> &lt;content-list>] [, &lt;identifier>
&lt;content-list>]* ] | none
<tr>
<td><em>Initial:</em>
<td>none
<tr>
<td><em>Applies to:</em>
<td>all elements
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>all
<tr>
<td><em>Computed value:</em>
<td>as specified value
</table>
<p>The ‘<a href="#string-set"><code
class=property>string-set</code></a>’ property accepts a comma-separated
list of named strings. Each named string is followed by a content list
that specifies which text to copy into the named string. Whenever an
element with value of ‘<a href="#string-set"><code
class=property>string-set</code></a>’ different from ‘<code
class=css>none</code>’ is encountered, the named strings are assigned
their respective value.
<p>&lt;content-list> expands to one or more of these values, in any order:
<dl>
<dt>&lt;string&gt;
<dd>a string, e.g. "foo"
<dt>&lt;counter&gt;
<dd>the counter() or counters() function, as per <a
href="http://www.w3.org/TR/CSS21/syndata.html#counter">CSS 2.1 section
4.3.5</a>
<dt class=unimplemented>contents()
<dd class=unimplemented>The textual content of the element, including the
content of its ::before and ::after pseudo-element. The content of the
element's descendants, including their respective ::before and ::after
pseudo-elements, are included in the returned content.
<dt><!--content-element-->content(text)
<dd>The textual content of the element, not including the content of its
::before and ::after pseudo-element. The content of the element's
descendants, including their respective ::before and ::after
pseudo-elements, are included in the returned content. This is the
default value, so ‘<code class=css>content()</code>’ is equivalent to
‘<code class=css>content(text)</code>’.
<dt><!--content-before-->content(before)
<dd>The textual content of the ::before pseudo-element the content of the
element.
<dt><!--content-after-->content(after)
<dd>The textual content of the ::after pseudo-element the content of the
element.
<dt><!--content-first-letter-->content(first-letter)
<dd>The first letter of the content of the element. The definition of a
letter is the same as for :first-letter pseudo-elements.
<!--<p class="note">The expected use for ''first-letter'' is to create one-letter headers, e.g., in dictionaries.</p>-->
</dl>
<dl class=unimplemented>
<dt>env()
<dd>This function returns data from the local environment of the user at
the time of formatting. The function accepts one of these keywords:
<ul>
<li>env(url): returns the URL of the document
<li>env(date): returns the date on the user's system at the time of
formatting
<li>env(time): returns the time on the user's system at the time of
formatting
<li>env(date-time): returns the date and time on the user's system at
the time of formatting
</ul>
<p>Information about date and time is formatted according to the locale
of the user's system.
<p class=issue>Or, should there be a way to specify the locale? Or should
we simply format all in ISO format (e.g., 2010-03-30)?
<p class=note>On many systems, preformatted strings in the user's locale
can be found through the <a
href="http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html">strftime</a>
function. The date, time and date-time strings can be found by using the
"%x", "%X" and "%c" conversion strings, respectively.
<div class=example>
<pre>
@page {
@top-right { content: env(url) }
@bottom-right { content: env(date-time) }
}
</pre>
</div>
</dl>
<p>Named strings can only hold the result of one assignment; whenever a new
assignment is made to a named string, its old value is replaced.
<p class=note>User agents, however, must be able to remember the result of
more than one assignment as the ‘<code class=css>string()</code>’
functional value (described below) can refer to different assignments.
<p>The scope of a named string is the page of the element to which the
‘<a href="#string-set"><code class=property>string-set</code></a>’
property is attached and subsequent pages. <!--
<p>The name space of named strings is different from other sets of
names in CSS.
-->
<p>The textual content is processed as if ‘<code class=css>white-space:
normal</code>’ had been set.
<div class=example>
<pre>
h2 {
string-set: header "Chapter " counter(header) ": " content();
counter-increment: header;
}
&lt;h2>Europa&lt;/h2>
</pre>
<!-- string-set: header "Chapter " counter(header) ": " contents;-->
<p>Note that the string called "header" is different from the counter with
the same name. The above code may result in the string called "header" is
set to "Chapter 2: Europa".
</div>
<div class=example>
<p>This example results in the same value being assigned to
<em>header</em> as in the previous example.
<pre>
h2:before { content: "Chapter " counter(header) }
h2 {
string-set: header content(before) content(text);
counter-increment: header }
</pre>
</div>
<div class=example>
<pre>
dt { string-set: index first-letter }
</pre>
</div>
<div class=example>
<p>The content is copied regardless of other settings on the element. In
HTML, TITLE elements are normally not displayed, but in this example the
content is copied into a named string:
<pre>
title {
display: none;
string-set: tittel content();
}
</pre>
</div>
<h4 id=using-named-strings><span class=secno>2.1.2. </span>Using named
strings</h4>
<p>The content of named strings can be recalled by using the ‘<code
class=css>string()</code>’ value on the ‘<code
class=property>content</code>’ property. The ‘<code
class=css>string()</code>’ value has one required argument, namely the
name of the string.
<div class=example>
<pre>
@page { @top-center { content: string(header) }}
@page { @right-middle { content: string(index) }}
@page { @top-left { content: string(entry) }}
h1 { string-set: header "Chapter " counter(chapter) content() }
dt { string-set: index first-letter, entry content() }
</pre>
<!--h1 { string-set: header "Chapter " counter(chapter) contents }
dt { string-set: index content-first-letter, entry contents }--></div>
<p>If the value of the named string is changed by an element on a certain
page, the named string may have several values on that page. In order to
specify which of these values should be used, an optional argument is
accepted on the ‘<code class=css>string()</code>’ value. This argument
can have one of four keywords:
<ul>
<li>‘<code class=css>first</code>’: the value of the first assignment
on the page is used. If there is no assignment on the page, the named
string's entry value is used. The entry value is the value held by the
string at the end of the previous page. ‘<code
class=css>first</code>’ is the default value.
<li>‘<code class=css>start</code>’: the value of the first assignment
on the page is used if the element begins the page or the named string
has not been assigned a value. Otherwise, the named string's entry value
is used.
<li>‘<code class=css>last</code>’: the named string's exit value is
used
<li>‘<code class=css>first-except</code>’: similar to ‘<code
class=css>first</code>’, except on the page where the value was
assigned. On that page, the empty string is used.
</ul>
<p>The assignment is considered to take place on the first page where a
content box representing the element occurs. If the element does not have
any content boxes (e.g., if ‘<code class=css>display: none</code>’ is
set), the assignment is considered to take place on the page where the
first content box would have occured if the element had been in the normal
flow.
<div class=example>
<p>In this example, the first term on the page will be shown in the top
left corner and the last term on the page will be shown in the top right
corner. In top center of the page, the first letter of first term will be
shown.
<pre>
@page { @top-left { content: string(term, first) }}
@page { @top-right { content: string(term, last) }}
@page { @top-center { content: string(index, first) }}
dt { string-set: index content(first-letter), term content(text) }
</pre>
</div>
<div class=example>
<p>Given this CSS code:
<pre>
h2 { string-set: header content() }
</pre>
<p>The value of the "header" string
<table class=string-set-example>
<tbody>
<tr>
<td>page#
<td>HTML code
<td>first
<td>start
<td>last
<td>first-except
<tr>
<td>1
<td>
<pre>&lt;h1>Continents&lt;/h1>
...
&lt;h2>Africa&lt;/h2>
...
...
</pre>
<td>Africa
<td>Africa
<td>Africa
<td>
<tr>
<td>2
<td>
<pre>...
&lt;h2>Americas&lt;/h2>
...
&lt;h2>Asia&lt;/h2>
...
</pre>
<td>Americas
<td>Africa
<td>Asia
<td>
<tr>
<td>3
<td>
<pre>...
...
...
...
</pre>
<td>Asia
<td>Asia
<td>Asia
<td>Asia
<tr>
<td>4
<td>
<pre>&lt;h2>Europe&lt;/h2>
...
&lt;h2>Oceania&lt;/h2>
..
</pre>
<td>Europe
<td>Europe
<td>Oceania
<td>
</table>
</div>
<div class=example>
<p>In this example, the term that is being described at the start of the
page is shown in the top left header.
<pre>
@page { @top-left { content: string(term, start) }}
dt { string-set: term content() }
</pre>
</div>
<div class=example>
<pre>
@page { @top-left { content: string(term, first) }}
@page { @top-right { content: string(term, last) }}
@page { @top-center { content: string(index, first) }}
dt { string-set: index content(first-letter), term content(text) }
</pre>
</div>
<div class=example>
<p>In this example, the header in the top center will be blank on pages
where ‘<code class=css>h1</code>’ elements appear. On other pages,
the string of the previous ‘<code class=css>h1</code>’ element will
be shown.
<pre>
@page { @top-center { content: string(chapter, first-except) }}
h1 { string-set: chapter content() }
</pre>
</div>
<p>If the named string referred to in a ‘<code
class=css>string()</code>’ value has not been assigned a value, the
empty string is used.
<h3 id=running-elements><span class=secno>2.2. </span>Running elements</h3>
<p>Named strings, as described above, can only hold textual content; any
style, structure or replaced content associated with the element is
ignored. To overcome this limitation, a way of moving elements into
running headers and footers is introduced.
<p>Elements that are moved into headers and footers are repeated on several
pages; they are said to be <a href="#running-elements0"><em>running
elements</em></a>. To support running elements, a new value – running()
– is introduced on the ‘<code class=property>position</code>’
property. It has one required argument: the name by which the running
element can be referred to. A running element is not shown in its natural
place; there it is treated as if ‘<code class=css>display:
none</code>’ had been set. Instead, the running element may be displayed
in a margin box.
<p>Like counters and named strings, the name of a running element is chosen
by the style sheet author, and the names have a separate name space. A
running element can hold one element, including its pseudo-elements and
its descendants. Whenever a new element is assigned to a running element,
the old element is lost.
<p class=note>User agents, however, must be able to remember the result of
more than one assignment as the ‘<code class=css>element()</code>’
value (described below) can refer to different assignments.
<p>Running elements inherit through their normal place in the structure of
the document.
<div class=example>
<pre>
title { position: running(header) }
@page { @top-center {
content: element(header) }
}
</pre>
</div>
<!--
<div class="example unimplemented">
<p>In this example, the element is copied into the running header but it also keeps its normal place.
<pre>
title { position: running(header), normal }
@page { @top-center {
content: element(header) }
}
</pre>
</div>
-->
<p>Like the ‘<code class=css>string()</code>’ value, the ‘<code
class=css>element()</code>’ value accepts an optional second argument:
<dl>
<dt>‘<code class=css>start</code>’
<dt>‘<code class=css>first</code>’
<dt>‘<code class=css>last</code>’
<dt>‘<code class=css>first-except</code>’
</dl>
<p>The keywords have the same meaning as for the ‘<code
class=css>string()</code>’ value, and the place of the assignments are
the same.
<p>The ‘<code class=css>element()</code>’ value cannot be combined with
any other values.
<div class=example>
<p>In this example, the header is hidden from view in all media types
except print. On printed pages, the header is displayed top center on all
pages, except where h1 elements appear.
<pre>
&lt;style>
div.header { display: none }
@media print {
div.header {
display: block;
position: running(header);
}
@page { @top-center { content: element(header, first-except) }}
&lt;/style>
...
&lt;div class="header">Introduction&lt;/div>
&lt;h1 class="chapter">An introduction&lt;/div>
</pre>
</div>
<div class=example>
<p>This code illustrates how to change the running header on one page in
the middle of a run of pages:
<pre>
...
&lt;style>
@page { @top-center {
content: element(header, first) }}
.header { position: running(header) }
.once { font-weight: bold }
&lt;/style>
...
&lt;div class="header">Not now&lt;/div>
&lt;p>Da di ha di da di ...
&lt;span class="header once">NOW!&lt;/span>
&lt;span class="header">Not now&lt;/span>
... da di ha di hum.&lt;/p>
...
</pre>
The header is "Not now" from the outset, due to the "div" element. The
first "span" element changes it to "<b>NOW!</b>" on the page where the
"span" element would have appeared. The second "span" element, which would
have appeared on the same page as the first is not used because the
‘<code class=css>first</code>’ keyword has been specified. However,
the second "span" element still sets the exit value for "header" and this
value is used on subsequent pages.</div>
<h2 id=leaders><span class=secno>3. </span>Leaders</h2>
<p>A leader is a visual pattern that guides the eye. Typically, leaders are
used to visually connect an entry in a list with a corresponding code. For
example, there are often leaders between titles and page numbers in a
table of contents (TOC). Another example is the phone book where there are
leaders between a name and a telephone number.
<p>In CSS3, a leader is composed of series of glyphs through the ‘<code
class=css>leader()</code>’ value on the ‘<code
class=property>content</code>’ property. The functional notation accepts
two values. The first describes the glyph pattern that makes up the
leader. These values are allowed:
<ul>
<li>leader(dotted)
<li>leader(solid)
<li>leader(space)
<li>leader(&lt;string&gt;)
</ul>
<p>Using the keyword values is equivalent to setting a string value. The
table below shows the equivalents:
<table class=border>
<tbody>
<tr>
<th>Keyword
<th>String
<th>Unicode characters
<tr>
<td>leader(dotted)
<td>leader(‘<code class=css>. </code>’)
<td>\002E \0020
<tr>
<td>leader(solid)
<td>leader(‘<code class=css>_</code>’)
<td>\005F
<tr>
<td>leader(space)
<td>leader(‘<code class=css> </code>’)
<td>\0020
</table>
<p>User Agents should attempt to align corresponding glyphs from the leader
pattern between consecutive lines.
<p>The string inside the parenthesis is called the <em>leader string</em>.
<p>In its simplest form, the ‘<code class=property>content</code>’
property only takes one ‘<code class=css>leader()</code>’ value:
<div class=example>
<pre>
heading::after { content: leader(dotted) }
</pre>
</div>
<p>The leader string must be shown in full at least once and this