8000 csswg-drafts/css3-gcpm/Overview.html at f3f4e9ac14812a1c5375e48329526bae23ab9105 · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
4472 lines (3341 loc) · 129 KB

File metadata and controls

4472 lines (3341 loc) · 129 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head>
<title>CSS Generated Content for Paged Media Module</title>
<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">
/*
.cols { width: 500px; height: 200px; background: #fff; position: relative; border: solid 10px blue; margin: 0.5em 2em 1em 0; font: bold 14px/19px Arial, sans-serif }
.cols p { padding: 3px; margin: 0 }
.col { position: absolute; left: 0px; top: 0; z-index: 6; width: 170px }
.gap { position: absolute; background: black; width: 5px; bottom: 0px; top: 0px; border: 10px solid red; border-top-width: 0; border-bottom-width: 0; }
.rep { position: absolute; top: 45px; background: #333; height: 110px; width: 100px; color: white; z-index: 4 }
*/
div.example img { display: block; margin: 1em 0 }
div.example:before { width: 9em !important }
div.example { padding-top: 0.5em }
table.hyphenate { border-collapse: collapse }
table.hyphenate th {
text-align: left; white-space: nowrap; border: 1px solid black; padding: 0.2em }
table.hyphenate td {
border: 1px solid black; padding: 0.2em 0.2em 0.2em 1em; font-size: 0.8em }
table.border, table.border td, table.border th, table.border table {
border-collapse: collapse;
border: thin solid black;
padding: 0.2em;
vertical-align: top;
}
table.border td + td { white-space: pre }
table.border table { padding: 0; border-collapse: separate; border: none; }
table.border table td { border: thin dotted black; padding: 0.2em; margin: 0.2em }
table.border .comment { margin-top: 0; white-space: normal; font-style: italic }
div.out { background: #F55; padding: 0.2em 0.5em }
div.out div.example { background: #FED }
h1, h2, h3, h4, h5, h6 { background: transparent }
.note + .note { text-indent: 0 }
</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--> <!--
/*
http://lists.w3.org/Archives/Public/www-style/2009Mar/0065.html
- RESOLVED: New syntax is image-resolution: normal | [ <dpi> || auto ]
RATIONALE: Removes unused combinations and unnecessary comma
- RESOLVED: Replace image-resolution: auto; with image-resolution: from-image;
RATIONALE: &lsquo;<code class=property>auto</code>&rsquo; vs. &lsquo;<code class=property>normal</code>&rsquo; is hard to understand. (&lsquo;<code class=property>normal</code>&rsquo; is 1 pixel == 1px)
- Discussed removing &lsquo;<code class=property>background-image-resolution</code>&rsq 1540 uo; in favor of various options.
So far idea is that &lsquo;<code class=property>image-resolution</code>&rsquo; applies to all images and we will
introduce functional notation in the future to allow setting resolution on a
per-image basis.
http://lists.w3.org/Archives/Public/www-style/2009Jun/0186.html
align lines: what did michael suggest?
Another approach would be to extend the height of the block to be a
multiple of the grid height, but then people would probably want to
control where the extra space gets added.
kerning?
-->
<!--
http://opengroup.org/onlinepubs/007908775/xbd/locale.html
d_t_fmt
Define the appropriate date and time representation, corresponding to the %c field descriptor. The operand consists of a string, and can contain any combination of characters and field descriptors. In addition, the string can contain escape sequences defined in the table in Escape Sequences and Associated Actions (\\, \a, \b, \f, \n, \r, \t, \v).
d_fmt
Define the appropriate date representation, corresponding to the %x field descriptor. The operand consists of a string, and can contain any combination of characters and field descriptors. In addition, the string can contain escape sequences defined in the table in Escape Sequences and Associated Actions .
t_fmt
Define the appropriate time representation, corresponding to the %X field descriptor. The operand consists of a string, and can contain any combination of characters and field descriptors. In addition, the string can contain escape sequences defined in the table in Escape Sequences and Associated Actions .
-->
<h1>CSS Generated Content for Paged Media Module</h1>
<h2 class="no-num no-toc" id=w3c-working>Editor's Draft 1 November 2010</h2>
<dl>
<dt>This version:
<dd><a
href="http://www.w3.org/TR/2010/ED-css3-gcpm-20101101">http://www.w3.org/TR/2010/ED-css3-gcpm-20101101</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/2007/WD-css3-gcpm-20070205">
http://www.w3.org/TR/2007/WD-css3-gcpm-20070205</a>
<dt>Editor:
<dd>H&aring;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> &copy; 2010 <a
href="http://www.w3.org/"><acronym title="World Wide Web
Consortium">W3C</acronym></a><sup>&reg;</sup> (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym
title="European Research Consortium for Informatics and
Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio</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
&ndash; multi-column layout and paged media &ndash; this module offers
advanced functionality for presenting structured documents on paged media.
This specification only applies to the &lsquo;<code
class=property>print</code>&rsquo; media type.
<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
&#8220;css3-gcpm&#8221; in the subject, preferably like this:
&#8220;[<!---->css3-gcpm<!---->] <em>&hellip;summary of
comment&hellip;</em>&#8221;
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/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="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<p>This functionality described in this WD is scaled down compared to
earlier versions. The remaining functionality is considered to be useful,
to fit well into the CSS framework, and to be within reach of
implementations. Indeed, significant parts of the draft has already been
implemented.
<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=secno>2.1.1. </span>Setting named strings: the &lsquo;<code
class=property>string-set</code>&rsquo; 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 &lsquo;<code
class=css>target-counter</code>&rsquo; and &lsquo;<code
class=css>target-counters</code>&rsquo; values</a>
<li><a href="#the-target-text-value"><span class=secno>4.2. </span>The
&lsquo;<code class=css>target-text</code>&rsquo; 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="#hyphenation"><span class=secno>6. </span>Hyphenation</a>
<ul class=toc>
<li><a href="#the-hyphens-property"><span class=secno>6.1. </span>The
&lsquo;<code class=property>hyphens</code>&rsquo; property</a>
<li><a href="#the-hyphenate-resource-property"><span class=secno>6.2.
</span>The &lsquo;<code class=property>hyphenate-resource</code>&rsquo;
property</a>
<li><a href="#the-hyphenate-before-and-hyphenate-after"><span
class=secno>6.3. </span>The &lsquo;<code
class=property>hyphenate-before</code>&rsquo; and &lsquo;<code
class=property>hyphenate-after</code>&rsquo; properties</a>
<li><a href="#the-hyphenate-lines-property"><span class=secno>6.4.
</span>The &lsquo;<code class=property>hyphenate-lines</code>&rsquo;
property</a>
<li><a href="#the-hyphenate-character-property"><span class=secno>6.5.
</span>The &lsquo;<code
class=property>hyphenate-character</code>&rsquo; property</a>
<li><a href="#the-hyphenate-last-line-avoid-property"><span
class=secno>6.6. </span>The &lsquo;<code
class=property>hyphenate-last-line-avoid</code>&rsquo; property</a>
</ul>
<li><a href="#new-counter-styles"><span class=secno>7. </span>New counter
styles</a>
<ul class=toc>
<li><a href="#the-super-decimal-list-style-type"><span class=secno>7.1.
</span>The &lsquo;<code class=css>super-decimal</code>&rsquo;
list-style-type</a>
<li><a href="#named-counter-styles"><span class=secno>7.2. </span>Named
counter styles</a>
<li><a href="#the-symbols-list-style-type"><span class=secno>7.3.
</span>The &lsquo;<code class=css>symbols()</code>&rsquo;
list-style-type</a>
</ul>
<li><a href="#image-resolution"><span class=secno>8. </span>Image
resolution</a>
<li><a href="#page-marks-and-bleed-area"><span class=secno>9. </span>Page
marks and bleed area</a>
<li><a href="#bookmarks"><span class=secno>10. </span>Bookmarks</a>
<li><a href="#cmyk-colors"><span class=secno>11. </span>CMYK colors</a>
<li><a href="#styling-blank-pages"><span class=secno>12. </span>Styling
blank pages</a>
<li>< 1540 ;a href="#page-selection-nth"><span class=secno>13. </span>Page
selection: nth()</a>
<li><a href="#page-floats"><span class=secno>14. </span>Page floats</a>
<ul class=toc>
<li><a href="#float-intrusion-in-multicol-elements"><span
class=secno>14.1. </span>Float intrusion in multicol elements</a>
</ul>
<li><a href="#advanced-multi-column-layout"><span class=secno>15.
</span>Advanced multi-column layout</a>
<ul class=toc>
<li><a href="#the-float-offset-property"><span class=secno>15.1.
</span>The &lsquo;<code class=property>float-offset</code>&rsquo;
property</a>
<li><a href="#aligning-baselines"><span class=secno>15.2.
</span>Aligning baselines</a>
</ul>
<li><a href="#conformance"><span class=secno>16. </span>Conformance</a>
<li><a href="#appendix-a-default-style-sheet"><span class=secno>17.
</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., hyphenation, the
new list style types, and border segments) may also used with other media
types. However, this specification is only concerned with the &lsquo;<code
class=property>print</code>&rsquo; media type.
<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 &lsquo;<a
href="#string-set"><code class=property>string-set</code></a>&rsquo;
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 content() }
</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 &lsquo;<code class=property>content</code>&rsquo;
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 &lsquo;<a href="#string-set"><code
class=property>string-set</code></a>&rsquo; 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&nbsp;value:</em>
<td>as specified value
</table>
<p>The &lsquo;<a href="#string-set"><code
class=property>string-set</code></a>&rsquo; 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 &lsquo;<a href="#string-set"><code
class=property>string-set</code></a>&rsquo; different from &lsquo;<code
class=css>none</code>&rsquo; is encountered, the named strings are
assigned their respective value.
<p>For the &lsquo;<a href="#string-set"><code
class=property>string-set</code></a>&rsquo; property, &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>&lt;content&gt;
<dd>the &lsquo;<code class=css>content()</code>&rsquo; function returns
the content of elements and pseudo-elements. The functional notation
accepts an optional argument:
<dl>
<dt>&lsquo;<code class=css>content()</code>&rsquo;
<dd>Without any arguments, the function returns 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.
<dt>&lsquo;<code class=css>content(before)</code>&rsquo;
<dd>The function returns the textual content of the ::before
pseudo-element the content of the element.
<dt>&lsquo;<code class=css>content(after)</code>&rsquo;
<dd>The function returns the textual content of the ::after
pseudo-element the content of the element.
<dt>&lsquo;<code class=css>content(first-letter)</code>&rsquo;
<dd>The function returns 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 &lsquo;<code
class=css>content(first-letter)</code>&rsquo; is to create one-letter
headers, e.g., in dictionaries.</p>
<dt>&lsquo;<code class=css>env()</code>&rsquo;
<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>
</dl>
<!--<p class="issue">Should target-counter() and leader() also be allowed?</p>-->
<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 &lsquo;<code
class=css>string()</code>&rsquo; 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
&lsquo;<a href="#string-set"><code
class=property>string-set</code></a>&rsquo; property is attached and
subsequent pages.
<p>The name space of named strings is different from other sets of names in
CSS.
<p>The &lsquo;<a href="#string-set"><code
class=property>string-set</code></a>&rsquo; property copies text as well
as white-space into the named string.
<div class=example>
<pre>
h2 {
string-set: header "Chapter " counter(header) ": " content();
counter-increment: header;
}
</pre>
<p>Note that the string called "header" is different from the counter with
the same name. The above code may result in <em>header</em> being 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. <!--note namespace-->
<pre>
h2:before { content: "Chapter " counter(header) }
h2 {
string-set: header content(before) content();
counter-increment: header }
</pre>
</div>
<div class=example>
<pre>
dt { string-set: index content(first-letter) }
</pre>
</div>
<div class=example>
<p>The content is copied regardless of other settings on the element. In
this example, H1 elements are not displayed, but their content is copied
into the named string.
<pre>
h1 {
display: none;
string-set: header 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 &lsquo;<code
class=css>string()</code>&rsquo; value on the &lsquo;<code
class=property>content</code>&rsquo; property. The &lsquo;<code
class=css>string()</code>&rsquo; 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 content(first-letter), entry content() }
</pre>
</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 &lsquo;<code class=css>string()</code>&rsquo; value. This
argument can have one of four keywords:
<ul>
<li>&lsquo;<code class=css>start</code>&rsquo;: the named string's entry
value for that page is used.
<li>&lsquo;<code class=css>first</code>&rsquo;: the value of the first
assignment is used. If there is no assignment on the page, the start
value is used. &lsquo;<code class=css>first</code>&rsquo; is the default
value.
<li>&lsquo;<code class=css>last</code>&rsquo;: the named string's exit
value for that page is used
<li>&lsquo;<code class=css>first-except</code>&rsquo;: similar to
&lsquo;<code class=css>first</code>&rsquo;, except on the page where the
value was assigned. On that page, the empty string is used.
</ul>
<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() }
</pre>
</div>
<div class=example>
<p>In this example, the header in the top center will be blank on pages
where &lsquo;<code class=css>h1</code>&rsquo; elements appear. On other
pages, the string of the previous &lsquo;<code class=css>h1</code>&rsquo;
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 &lsquo;<code
class=css>string()</code>&rsquo; 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 8096 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 &ndash;
running() &ndash; is introduced on the &lsquo;<code
class=property>position</code>&rsquo; 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 &lsquo;<code class=css>display: none</code>&rsquo; 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 &lsquo;<code
class=css>element()</code>&rsquo; 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>
<p>Like the &lsquo;<code class=css>string()</code>&rsquo; value, the
&lsquo;<code class=css>element()</code>&rsquo; value accepts an optional
second argument:
<dl>
<dt>&lsquo;<code class=css>start</code>&rsquo;
<dt>&lsquo;<code class=css>first</code>&rsquo;
<dt>&lsquo;<code class=css>last</code>&rsquo;
<dt>&lsquo;<code class=css>first-except</code>&rsquo;
</dl>
<p>The keywords have the same meaning as for the &lsquo;<code
class=css>string()</code>&rsquo; value.
<p>The &lsquo;<code class=css>element()</code>&rsquo; 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
&lsquo;<code class=css>first</code>&rsquo; 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
&lsquo;<code class=css>leader()</code>&rsquo; value on the &lsquo;<code
class=property>content</code>&rsquo; property. The functional notation
accepts one value which describes the glyph pattern that make 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(&lsquo;<code class=css>. </code>&rsquo;)
<td>\002E \0020
<tr>
<td>leader(solid)
<td>leader(&lsquo;<code class=css>_</code>&rsquo;)
<td>\005F
<tr>
<td>leader(space)
<td>leader(&lsquo;<code class=css&g BD17 t; </code>&rsquo;)
<td>\0020
</table>
<!--
<p class="issue">Some fonts may not have suitable glyphs for all
patterns. For example, in some Eastern languages, the alignment of the
shape within the glyph may not be optimal for creating leaders.
-->
<!--<p class="issue">Are the keywords really necessary?</p>-->
<p>The string inside the parenthesis is called the <em>leader string</em>.
<p>In its simplest form, the &lsquo;<code
class=property>content</code>&rsquo; property only takes one &lsquo;<code
class=css>leader()</code>&rsquo; 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
establishes the minimum length of the leader. To fill the available space,
the leader string is repeated as many times as possible in the writing
direction. At the end of the leader, a partial string pattern may be
shown. White space in leaders is collapsed according to the values on
white-space properties.
<!-- <span class="issue">Or, partial strings be avoided?</span> -->
<!--<p class="issue">Should other properties influence the appearance of leaders?-->
<p>These properties influence the appearance of leaders: all font
properties, text properties, &lsquo;<code
class=property>letter-spacing</code>&rsquo;, white-space properties,
background properties, and &lsquo;<code
class=property>color</code>&rsquo;.
<p>User Agents should attempt to align corresponding glyphs from the leader
pattern between consecutive lines.
<p>In a more complex example, the &lsquo;<code
class=property>leader</code>&rsquo; value is combined with other values on
the &lsquo;<code class=property>content</code>&rsquo; property:
<div class=example>
<pre>
ul.toc a::after {
content: leader(". . . ") target-counter(attr(href, url), page);
}
</pre>
</div>
<p>If the content connected by a leader end up on different lines, the
leader will be present on all lines. Each leader fragment honors the
minimum length of the leader.
<div class=example>
<p>Consider this code:
<pre>
&lt;style>
.name::after { content: leader(dotted) }
&lt;/style>
&lt;div class="entry">
&lt;span class="name">John Doe&lt;/span>
&lt;span class="number">123456789&lt;/span>
&lt;/div>
</pre>
<p>If the name and number end up on different lines (e.g., in a narrow
column), it may be formatted like this:
<pre>
John Doe....
...123456789
</pre>
</div>
<p>To determine the length of the leaders, user agents must do the
following for each line:
<ol>
<li>Lay out the content with leaders of minimum lengths
<li>Determine the empty space left on the line.
<li>Distribute the empty space between the leaders on the line. Glyphs
must not be shown partially. All leaders on the line should, to the
extent possible, have the same length. This may not always be possible as
the minimum leader length must be honored.
<li>Fill the empty space with the specified leader pattern.
</ol>
<div class=example>
<p>Consider this code:
<pre>
&lt;style>
cite::before { content: leader(' ') }
&lt;/style>
&lt;blockquote>
Bla great bla bla world bla bla
empire bla bla color bla bla
history bla bla forever.
&lt;cite>John Johnson&lt;/cite>
&lt;/blockquote>
</pre>
<p>Depending on the width of the containing block, this may be rendered
as:
<pre>
Bla great bla bla world bla bla
empire bla bla color bla bla
history bla bla forever. John
Johnson
</pre>
<p>However, this rendering is preferable:
<pre>
Bla great bla bla world bla bla
empire bla bla color bla bla
history bla bla forever.
John Johnson
</pre>
<p>To indicate that <q>John Johnson</q> should be kept on one line, this
rule can be added to the style sheet:
<pre>
cite { text-wrap: suppress }
</pre>
<p>Until &lsquo;<code class=property>text-wrap</code>&rsquo; is widely
supported, this rule can also be used:
<pre>
cite { white-space: nowrap }
</pre>