forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2009-06-10.html
6112 lines (4609 loc) · 172 KB
/
2009-06-10.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head>
<title>CSS3 module: Generated Content for Paged Media</title>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="https://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 }
.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: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 }
</style>
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="https://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS3 module: Generated Content for Paged Media</h1>
<h2 class="no-num no-toc" id=w3c-working>Editor's Draft 10 June 2009</h2>
<dl>
<dt>This version:
<dd><a
href="http://www.w3.org/TR/2009/ED-css3-gcpm-20090610">http://www.w3.org/TR/2009/ED-css3-gcpm-20090610</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å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> © 2009 <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.org/"><abbr title="European Research Consortium
for Informatics and Mathematics">ERCIM</abbr></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
– multi-column layout and paged media – this module offers
advanced functionality for presenting structured documents on paged media.
This specification only applies to the ‘<code
class=property>print</code>’ 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">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="/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 WD describes functionality at various levels of maturity. Some
features have been part of other WDs in the past and have already been
implemented. These parts are fairly stable and unlikely to change much.
Other features are still at the sketching stage. In general, features
presented earlier in this draft are more mature that those presented later
in the draft.
<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="#dependencies"><span class=secno>1 </span>Dependencies on
other modules</a>
<li><a href="#introduction"><span class=secno>2 </span>Introduction</a>
<li><a href="#running-headers-and-footers"><span class=secno>3
</span>Running headers and footers</a>
<ul class=toc>
<li><a href="#named-strings"><span class=secno>3.1 </span>Named
strings</a>
<ul class=toc>
<li><a href="#setting-named-strings-the-string-set-pro"><span
class=secno>3.1.1 </span>Setting named strings: the ‘<code
class=property>string-set</code>’ property</a>
<li><a href="#using-named-strings"><span class=secno>3.1.2
</span>Using named strings</a>
</ul>
<li><a href="#running-elements"><span class=secno>3.2 </span>Running
elements</a>
</ul>
<li><a href="#leaders"><span class=secno>4 </span>Leaders</a>
<li><a href="#cross-references"><span class=secno>5
</span>Cross-references</a>
<ul class=toc>
<li><a href="#the-target-counter-and-target-counters-v"><span
class=secno>5.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>5.2 </span>The
‘<code class=css>target-text</code>’ value</a>
</ul>
<li><a href="#footnotes"><span class=secno>6 </span>Footnotes</a>
<ul class=toc>
<li><a href="#turning-elements-into-footnotes"><span class=secno>6.1
</span>Turning elements into footnotes</a>
<li><a href="#the-footnote-area"><span class=secno>6.2 </span>The
footnote area</a>
<li><a href="#footnote-calls"><span class=secno>6.3 </span>Footnote
calls</a>
<li><a href="#footnote-markers"><span class=secno>6.4 </span>Footnote
markers</a>
<li><a href="#counting-footnotes"><span class=secno>6.5 </span>Counting
footnotes</a>
<li><a href="#laying-out-footnotes"><span class=secno>6.6 </span>Laying
out footnotes</a>
<li><a href="#footnote-magic"><span class=secno>6.7 </span>Footnote
magic</a>
</ul>
<li><a href="#border-parts"><span class=secno>7 </span>Border parts</a>
<ul class=toc>
<li><a href="#the-border-parts-properties"><span class=secno>7.1
</span>The ‘<code class=property>border-parts</code>’
properties</a>
</ul>
<li><a href="#pulling-elements-the-target-pull-value"><span class=secno>8
</span>Pulling elements: the ‘<code
class=css>target-pull()</code>’ value</a>
<li><a href="#pushing-elements-named-flows"><span class=secno>9
</span>Pushing elements: named flows</a>
<li><a href="#hyphenation"><span class=secno>10 </span>Hyphenation</a>
<ul class=toc>
<li><a href="#hyphenate-properties"><span class=secno>10.1
</span>Hyphenate properties</a>
<li><a href="#named-counter-styles"><span class=secno>10.2 </span>Named
counter styles</a>
<li><a href="#the-symbols-list-style-type"><span class=secno>10.3
</span>The ‘<code class=css>symbols()</code>’
list-style-type</a>
</ul>
<li><a href="#character-substitution"><span class=secno>11
</span>Character substitution</a>
<ul class=toc>
<li><a href="#the-text-replace-property"><span class=secno>11.1
</span>The ‘<code class=property>text-replace</code>’
property</a>
</ul>
<li><a href="#image-resolution"><span class=secno>12 </span>Image
resolution</a>
<li><a href="#page-marks-and-bleed-area"><span class=secno>13 </span>Page
marks and bleed area</a>
<li><a href="#bookmarks"><span class=secno>14 </span>Bookmarks</a>
<li><a href="#cmyk-colors"><span class=secno>15 </span>CMYK colors</a>
<li><a href="#creating-paged-presentations"><span class=secno>16
</span>Creating paged presentations</a>
<li><a href="#styling-blank-pages"><span class=secno>17 </span>Styling
blank pages</a>
<li><a href="#page-floats"><span class=secno>18 </span>Page floats</a>
<li><a href="#advanced-multi-column-layout"><span class=secno>19
</span>Advanced multi-column layout</a>
<ul class=toc>
<li><a href="#the-float-offset-property"><span class=secno>19.1
</span>The ‘<code class=property>float-offset</code>’
property</a>
</ul>
<li><a href="#page-lists"><span class=secno>20 </span>Page lists</a>
<ul class=toc>
<li><a href="#the-page-property"><span class=secno>20.1 </span>The
‘<code class=property>page</code>’ property</a>
</ul>
<li><a href="#continuation-markers"><span class=secno>21
</span>Continuation markers</a>
<li><a href="#change-bars"><span class=secno>22 </span>Change bars</a>
<li><a href="#line-numbers"><span class=secno>23 </span>Line numbers</a>
<li><a href="#generated-lists"><span class=secno>24 </span>Generated
lists</a>
<ul class=toc>
<li><a href="#the-prototype-properties"><span class=secno>24.1
</span>The prototype properties</a>
<li><a href="#toc"><span class=secno>24.2 </span>TOC</a>
<li><a href="#glossary"><span class=secno>24.3 </span>Glossary</a>
<li><a href="#index0"><span class=secno>24.4 </span>Index</a>
<li><a href="#a-more-complex-example"><span class=secno>24.5 </span>A
more complex example</a>
</ul>
<li><a href="#conformance"><span class=secno>25 </span>Conformance</a>
<li><a href="#appendix-a-default-style-sheet"><span class=secno>26
</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=dependencies><span class=secno>1 </span>Dependencies on other
modules</h2>
<p>This CSS3 module has normative references to the following other CSS3
modules:
<ul>
<li><a href="#CSS3LIST" rel=biblioentry>[CSS3LIST]<!--{{!CSS3LIST}}--></a>
<li><a href="#CSS3VAL" rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a>
</ul>
<p>This CSS3 module has non-normative references to the following other
CSS3 modules:
<ul>
<li><a href="#CSS3COL" rel=biblioentry>[CSS3COL]<!--{{CSS3COL}}--></a>
<li><a href="#CSS3PAGE" rel=biblioentry>[CSS3PAGE]<!--{{CSS3PAGE}}--></a>
<li>[[CSS3MULTICOL]]
</ul>
<h2 id=introduction><span class=secno>2 </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 ‘<code
class=property>print</code>’ media type.
<h2 id=running-headers-and-footers><span class=secno>3 </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>3.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 ‘<code
class=property><a href="#string-set">string-set</a></code>’ 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 ‘<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>3.1.1
</span>Setting named strings: the ‘<code class=property><a
href="#string-set">string-set</a></code>’ 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>[[ <identifier> <content-list>] [, <identifier>
<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 ‘<code class=property><a
href="#string-set">string-set</a></code>’ 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 ‘<code class=property><a
href="#string-set">string-set</a></code>’ different from
‘<code class=css>none</code>’ is encountered, the named
strings are assigned their respective value.
<p>For the ‘<code class=property><a
href="#string-set">string-set</a></code>’ property,
<content-list> expands to one or more of these values, in any order:
<dl>
<dt><string>
<dd>a string, e.g. "foo"
<dt><counter>
<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><content>
<dd>the ‘<code class=css>content()</code>’ function returns
the content of elements and pseudo-elements. The functional notation
accepts an optional argument:
<dl>
<dt>‘<code class=css>content()</code>’
<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>‘<code class=css>content(before)</code>’
<dd>The function returns the textual content of the ::before
pseudo-element the content of the element.
<dt>‘<code class=css>content(after)</code>’
<dd>The function returns the textual content of the ::after
pseudo-element the content of the element.
<dt>‘<code class=css>content(first-letter)</code>’
<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 ‘<code
class=css>content(first-letter)</code>’ is to create one-letter
headers, e.g., in dictionaries.</p>
</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 ‘<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
‘<code class=property><a
href="#string-set">string-set</a></code>’ property is attached and
subsequent pages.
<p>The name space of named strings is different from other sets of names in
CSS.
<p>The ‘<code class=property><a
href="#string-set">string-set</a></code>’ 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>3.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 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 ‘<code class=css>string()</code>’ value. This
argument can have one of four keywords:
<ul>
<li>‘<code class=css>start</code>’: the named string's entry
value for that page is used.
<li>‘<code class=css>first</code>’: the value of the first
assignment is used. If there is no assignment on the page, the start
value is used. ‘<code class=css>first</code>’ is the default
value.
<li>‘<code class=css>last</code>’: the named string's exit
value for that page 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>
<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 ‘<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.
<div class=out>
<h3 id=running-elements><span class=secno>3.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 <em><a
href="#running-elements0">running elements</a></em>. 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>
<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.
<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>
<style>
div.header { display: none }
@media print {
div.header {
display: block;
position: running(header);
}
@page { @top-center { content: element(header, first-except) }}
</style>
...
<div class="header">Introduction</div>
<h1 class="chapter">An introduction</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>
...
<style>
@page { @top-center {
content: element(header, first) }}
.header { position: running(header) }
.once { font-weight: bold }
</style>
...
<div class="header">Not now</div>
<p>Da di ha di da di ...
<span class="header once">NOW!</span>
<span class="header">Not now</span>
... da di ha di hum.</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>
</div>
<h2 id=leaders><span class=secno>4 </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 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(<string>)
</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 class=issue>Can leaders also be composed of images or SVG? <!--
<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 ‘<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
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, ‘<code
class=property>letter-spacing</code>’, white-space properties,
background properties, and ‘<code
class=property>color</code>’.
<p>User Agents should attempt to align corresponding glyphs from the leader
pattern between consecutive lines.
<p>In a more complex example, the ‘<code
class=property>leader</code>’ value is combined with other values on
the ‘<code class=property>content</code>’ 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>
<style>
.name::after { content: leader(dotted) }
</style>
<div class="entry">
<span class="name">John Doe</span>
<span class="number">123456789</span>
</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>
<style>
cite::before { content: leader(' ') }
</style>
<blockquote>
Bla great bla bla world bla bla
empire bla bla color bla bla
history bla bla forever.
<cite>John Johnson</cite>
</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 ‘<code class=property>text-wrap</code>’ is widely
supported, this rule can also be used:
<pre>
cite { white-space: nowrap }
</pre>
<p>If the containing element is wider, this may be the resultant
presentation:
<pre>
Bla great bla bla world bla bla empire
bla bla color bla bla history bla bla
forever. John Johnson
</pre>
</div>
<h2 id=cross-references><span class=secno>5 </span>Cross-references</h2>
<p>It is common to refer to other parts of a document by way of a section
number (e.g., "See section 3.4.1"), a page number (e.g., "See discussion
on page 72"), or a string (e.g., "See the chapter on Europe"). Being able
to resolve these cross-references automatically saves time and reduces the
number of errors.
<h3 id=the-target-counter-and-target-counters-v><span class=secno>5.1
</span>The ‘<code class=css>target-counter</code>’ and
‘<code class=css>target-counters</code>’ values</h3>
<p>Numerical cross-references are generated by ‘<code
class=css>target-counter()</code>’ and ‘<code
class=css>target-counters()</code>’ values that fetch the value of a
counter at the target end of the link. These functions are similar to the
‘<code class=css>counter()</code>’ and ‘<code
class=css>counters()</code>’ functions, except that they fetch
counter values from remote elements. ‘<code
class=css>target-counter()</code>’ has two required arguments: the
url of the link, and the name of a counter. ‘<code
class=css>target-counters()</code>’ has three required arguments:
the url of the link, the name of a counter, and a separator string. Both
functions accepts an optional argument at the end that describes which
list style type to use when presenting the resulting number; ‘<code
class=css>decimal</code>’ being the default.
<div class=example>
<p>This style sheet specifies that a string like " (see page 72)" is added
after a link:
<pre>
a::after { content: "(see page " target-counter(attr(href, url), page, decimal) ")" }
</pre>
</div>
<div class=example>
<p>This style sheet specifies that a string like " (see section 1.3.5)" is