-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
1329 lines (1058 loc) · 84.5 KB
/
Overview.html
File metadata and controls
1329 lines (1058 loc) · 84.5 KB
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><html lang=en><head>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Generated Content for Paged Media Module</title>
<link href=../default.css rel=stylesheet type=text/css>
<link href=../csslogo.ico rel="shortcut icon" type=image/x-icon>
<style>
body {
background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat white;
background-attachment: fixed;
color: black;
font-family: sans-serif;
margin: 0 auto;
max-width: 50em;
padding: 2em 1em 2em 70px;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a[href]:active { color: #C00; background: transparent }
a[href]:hover { background: #ffa }
a[href] img { border-style: none }
h1, h2, h3, h4, h5, h6 { text-align: left }
h1, h2, h3 { color: #005A9C; }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
pre { margin-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
</head>
<body class=h-entry>
<div class=head>
<p data-fill-with=logo><a class=logo href=http://www.w3.org/>
<img alt=W3C height=48 src=http://www.w3.org/Icons/w3c_home width=72>
</a>
</p>
<h1 class="p-name no-ref" id=title>CSS Generated Content for Paged Media Module</h1>
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
<span class=dt-updated><span class=value-title title=20140311>11 March 2014</span></span></span></h2>
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-gcpm/>http://dev.w3.org/csswg/css-gcpm/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-gcpm/>http://dev.w3.org/csswg/css-gcpm/</a><dt>Previous Versions:<dd><a href=https://dvcs.w3.org/hg/csswg/raw-file/6a5c44d11c2b/css-gcpm/Overview.html rel=previous>https://dvcs.w3.org/hg/csswg/raw-file/6a5c44d11c2b/css-gcpm/Overview.html</a><dd><a href=http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/ rel=previous>http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/</a>
<dt>Feedback:</dt>
<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>Test Suite:<dd>None Yet<dt>Editors:
<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:dave.cramer@hbgusa.com>Dave Cramer</a> (<span class="p-org org">Hachette Livre</span>)<dt>Former Editors:
<dd class="p-author h-card vcard"><span class="p-name fn">Håkon Wium Lie</span> (<span class="p-org org">Opera Software</span>)<dt>Issue Tracking:<dd><a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=CSS&component=Generated%20Content%20for%20Paged%20Media">W3C Bugzilla</a></dl></div>
<div data-fill-with=warning></div>
<p class=copyright data-fill-with=copyright><a href=http://www.w3.org/Consortium/Legal/ipr-notice#Copyright>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>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled heading" id=abstract><span class=content>Abstract</span></h2>
<p class=p-summary data-fill-with=abstract>Books and other paged media often use special techniques to display information. Content may be moved to or generated for special areas of the page, such as running heads or footnotes. Generated content within pages, such as tab leaders or cross-references, helps readers navigate within and between pages.
<a href=http://www.w3.org/TR/CSS/>CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.</p>
<h2 class="no-num no-toc no-ref heading settled heading" id=status><span class=content>Status of this document</span></h2>
<div data-fill-with=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=%5Bcss-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 “css-gcpm” in the subject,
preferably like this:
“[css-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>.</div>
<div data-fill-with=at-risk></div>
<h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class=content>Table of contents</span></h2>
<div data-fill-with=table-of-contents><ul class=toc><li><a href=#introduction><span class=secno></span>
Introduction
</a><li><a href=#running-headers><span class=secno>1</span>
Running headers and footers
</a><ul class=toc><li><a href=#named-strings><span class=secno>1.1</span>
Named strings
</a><ul class=toc><li><a href=#string-set><span class=secno>1.1.1</span>
The string-set property
</a><ul class=toc><li><a href=#content-function-header><span class=secno>1.1.1.1</span>The <span class=css data-link-type=maybe title=content()>content()</span> function</a></ul><li><a href=#string-function><span class=secno>1.1.2</span>
The <span class=css data-link-type=maybe title=string()>string()</span> function
</a></ul><li><a href=#running-elements><span class=secno>1.2</span>
Running elements
</a><ul class=toc><li><a href=#running-syntax><span class=secno>1.2.1</span>
The <span class=css data-link-type=maybe title=running()>running()</span> value
</a><li><a href=#alternative-syntax-running><span class=secno>1.2.2</span>Alternative Proposal from Bert Bos</a><li><a href=#element-syntax><span class=secno>1.2.3</span>
The <span class=css data-link-type=maybe title=element()>element()</span> value
</a></ul></ul><li><a href=#footnotes><span class=secno>2</span>
Footnotes
</a><ul class=toc><li><a href=#footnote-terms><span class=secno>2.1</span>Terminology</a><li><a href=#creating-footnotes><span class=secno>2.2</span>
Creating footnotes
</a><li><a href=#footnote-types><span class=secno>2.3</span>
Types of footnotes
</a><li><a href=#footnote-area><span class=secno>2.4</span>
The footnote area
</a><ul class=toc><li><a href=#footnote-area-position><span class=secno>2.4.1</span>Positioning of the footnote area</a><li><a href=#footnote-area-size><span class=secno>2.4.2</span>Size of the footnote area</a></ul><li><a href=#footnote-counters><span class=secno>2.5</span>The Footnote Counter</a><ul class=toc><li><a href=#footnote-counter-values><span class=secno>2.5.1</span>Values of the footnote counter</a><li><a href=#resetting-footnote-counter><span class=secno>2.5.2</span>Resetting the footnote counter</a></ul><li><a href=#footnote-call><span class=secno>2.6</span>
The <code>footnote-call</code> pseudo-element
</a><li><a href=#footnote-marker><span class=secno>2.7</span>
The <code>footnote-marker</code> pseudo-element
</a><li><a href=#footnote-policy><span class=secno>2.8</span>
Rendering footnotes and <code>footnote policy</code>
</a><li><a href=#future><span class=secno>2.9</span>
Future directions
</a></ul><li><a href=#page-selectors><span class=secno>3</span>
Selecting Pages
</a><ul class=toc><li><a href=#document-page-selectors><span class=secno>3.1</span>
Page Selectors
</a><li><a href=#document-sequence-selectors><span class=secno>3.2</span>
Page groups
</a></ul><li><a href=#leaders><span class=secno>4</span>
Leaders
</a><ul class=toc><li><a href=#rendering-leaders><span class=secno>4.1</span>
Rendering leaders
</a><ul class=toc><li><a href=#procedure-leader><span class=secno>4.1.1</span>
Procedure for rendering leaders
</a></ul></ul><li><a href=#xref><span class=secno>5</span>
Cross-references
</a><ul class=toc><li><a href=#target-counter><span class=secno>5.1</span>
The <span class=css data-link-type=maybe title=target-counter()>target-counter()</span> function
</a><li><a href=#target-counters><span class=secno>5.2</span>
The <span class=css data-link-type=maybe title=target-counters()>target-counters()</span> function
</a><li><a href=#target-text><span class=secno>5.3</span>
target-text
</a></ul><li><a href=#bookmarks><span class=secno>6</span>
Bookmarks
</a><ul class=toc><li><a href=#bookmark-level><span class=secno>6.1</span>
bookmark-level
</a><li><a href=#bookmark-label><span class=secno>6.2</span>
bookmark-label
</a><li><a href=#bookmark-state><span class=secno>6.3</span>
bookmark-state
</a></ul><li><a href=#ua-stylesheet><span class=secno></span>Appendix A: Default UA Stylesheet</a><li><a href=#changes><span class=secno></span>Appendix B: Changes</a><li><a href=#acknowledgments><span class=secno></span>
Acknowledgments
</a><li><a href=#conformance><span class=secno></span>
Conformance</a><ul class=toc><li><a href=#conventions><span class=secno></span>
Document conventions</a><li><a href=#conformance-classes><span class=secno></span>
Conformance classes</a><li><a href=#partial><span class=secno></span>
Partial implementations</a><li><a href=#experimental><span class=secno></span>
Experimental implementations</a><li><a href=#testing><span class=secno></span>
Non-experimental implementations</a></ul><li><a href=#references><span class=secno></span>
References</a><ul class=toc><li><a href=#normative><span class=secno></span>
Normative References</a><li><a href=#informative><span class=secno></span>
Informative References</a></ul><li><a href=#index><span class=secno></span>
Index</a><li><a href=#property-index><span class=secno></span>
Property index</a><li><a href=#issues-index><span class=secno></span>Issues Index</a></ul></div>
<h2 class="no-num heading settled heading" id=introduction><span class=content>
Introduction
</span></h2>
<p>Paged media have many <a href=http://w3c.github.io/dpub-pagination/index.html>special requirements</a> for the display of document content, which have evolved over the long history of printed books. Running headers and footers function as aids to navigation. Notes may appear at the bottom of the page, as footnotes. The properties of pages themselves may change based on their content or position in the document. Leaders visually connect related content. Cross-references may require generated text. Some paged media formats such as PDF use bookmarks for navigation.
<p>This module defines new properties and values, so that authors may bring these techniques to paged media.
<h2 class="heading settled heading" data-level=1 id=running-headers><span class=secno>1 </span><span class=content>
Running headers and footers
</span><a class=self-link href=#running-headers></a></h2>
<a data-biblio-type=informative data-link-type=biblio href=#css3page title=css3page>[CSS3PAGE]</a> describes the sixteen page margin boxes which can be used for running headers and footers, but does not describe a mechanism for inserting content in those boxes. This module provides two methods for for doing so. <dfn data-dfn-type=dfn data-noexport="" id=named-string title="named string">Named strings<a class=self-link href=#named-string></a></dfn> copy text for reuse in margin boxes. <dfn data-dfn-type=dfn data-noexport="" id=running-elements0>Running elements<a class=self-link href=#running-elements0></a></dfn> move elements (complete with style and structure) from the document to margin boxes.
<h3 class="heading settled heading" data-level=1.1 id=named-strings><span class=secno>1.1 </span><span class=content>
Named strings
</span><a class=self-link href=#named-strings></a></h3>
The <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property copies the text content of an element into a <a class=css data-link-type=maybe href=#named-string title="named string">named string</a>, which functions as a variable. The text content of this named string can be retrieved using the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function. Since these variables may change on a given page, an optional second value for the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function allows authors to choose which value on a page is used.
<h4 class="heading settled heading" data-level=1.1.1 id=string-set><span class=secno>1.1.1 </span><span class=content>
The string-set property
</span><a class=self-link href=#string-set></a></h4>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-string-set>string-set<a class=self-link href=#propdef-string-set></a></dfn><tr><th>Value:<td>[[ <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-content-3/#ltcontent-listgt title="<content-list>"><content-list></a>] [, <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-content-3/#ltcontent-listgt title="<content-list>"><content-list></a>]* ] | none<tr><th>Initial:<td>none<tr><th>Applies to:<td>all elements, but not pseudo-elements<tr><th>Inherited:<td>no<tr><th>Media:<td>all<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table>
<p>The <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property contains one or more pairs, each consisting of an custom identifier (the name of the named string) followed by a <a class=css data-link-type=maybe href=#content-list title=content-list>content-list</a> describing how to construct the value of the named string.
<p><a class=css data-link-type=maybe href=#content-list title=content-list>content-list</a> expands to one or more of the following values, in any order.
<pre class=prod> <dfn data-dfn-type=dfn data-noexport="" id=content-list>content-list<a class=self-link href=#content-list></a></dfn> = [ <string> | <counter()> | <counters()> | <content()> | attr(<identifier>) ]+
</identifier></pre>
<dl data-dfn-for=content-list data-dfn-type=value>
<dt> <string> </dt>
<dd> A <a href=http://www.w3.org/TR/CSS21/syndata.html#strings>string</a>, as defined in <a data-biblio-type=informative data-link-type=biblio href=#css21 title=css21>[CSS21]</a> </dd>
<dt> <counter()> </dt>
<dd> A <a href=http://www.w3.org/TR/CSS21/syndata.html#counter>counter()</a> function, as described in <a data-biblio-type=informative data-link-type=biblio href=#css21 title=css21>[CSS21]</a>.</dd>
<dt> <counters()> </dt>
<dd> A <a href=http://www.w3.org/TR/CSS21/syndata.html#counter>counters()</a> function, as described in <a data-biblio-type=informative data-link-type=biblio href=#css21 title=css21>[CSS21]</a>.</dd>
<dt>content()</dt>
<dd>The <a class=css data-link-type=maybe href=#funcdef-content title=content()>content()</a> function, described below.</dd>
<dt>attr(<identifier>)</dt>
<dd>Returns the string value of the attribute <identifier>, as defined in <a data-biblio-type=informative data-link-type=biblio href=#css3val title=css3val>[CSS3VAL]</a></dd>
</dl>
<h5 class="heading settled heading" data-level=1.1.1.1 id=content-function-header><span class=secno>1.1.1.1 </span><span class=content>The <a class=css data-link-type=maybe href=#funcdef-content title=content()>content()</a> function</span><a class=self-link href=#content-function-header></a></h5>
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-content>content()<a class=self-link href=#funcdef-content></a></dfn> = content([text | before | after | first-letter ])
</pre>
<dl data-dfn-for=content() data-dfn-type=value>
<dt>text</dt>
<dd>The string value of the element, determined as if <code>white-space: normal</code> had been set. This is the default value</dd>
<dt>before</dt>
<dd>The string value of the <code>::before</code> pseudo-element, determined as if <code>white-space: normal</code> had been set. </dd>
<dt>after</dt>
<dd>The string value of the <code>::after</code> pseudo-element, determined as if <code>white-space: normal</code> had been set. </dd>
<dt>first-letter</dt>
<dd>The first letter of the element, as defined for the <code><a href=http://www.w3.org/TR/css3-selectors/#first-letter>::first-letter</a></code> pseudo-element </dd>
</dl>
<p>The content values of named strings are assigned at the point when the content box of the element is first created (or would have been created if the element’s display value is none). The <dfn data-dfn-type=dfn data-noexport="" id=entry-value>entry value<a class=self-link href=#entry-value></a></dfn> for a page is the assignment in effect at the end of the previous page. The <dfn data-dfn-type=dfn data-noexport="" id=exit-value>exit value<a class=self-link href=#exit-value></a></dfn> for a page is the assignment in effect at the end of the current page.
<p>Whenever the value of the element changes, the value of the named string(s) is updated. User agents must be able to recall many values of the named string, as the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function can return past, current, or future values of the assignment.
<div class=example>
HTML:
<pre><h1>Loomings</h1>
</pre><p>CSS:
<pre>h1::before { content: 'Chapter ' counter(chapter); }
h1 { string-set: header content(before) ':' content(text); }
h1::after { content: '.'; }
</pre>
<p>The value of the named string “header” will be “Chapter 1: Loomings”.
</div>
<div class=example>
HTML:
<pre><section title="Loomings">
</pre><p>CSS:
<pre>section { string-set: header attr(title) }
</pre><p>The value of the “header” string will be “Loomings”.
</div>
<h4 class="heading settled heading" data-level=1.1.2 id=string-function><span class=secno>1.1.2 </span><span class=content>
The <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function
</span><a class=self-link href=#string-function></a></h4>
The <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function is used to copy the value of a named string to the document, via the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-content-3/#content title=content>content</a> property. This function requires one argument, the name of the named string. Since the value of a named string may change several times on a page (as new instances of the element defining the string appear) an optional second argument indicates which value of the named string should be used.
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-string>string()<a class=self-link href=#funcdef-string></a></dfn> = string( <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> [ , [ first | start | last | first-except] ]? )
</pre>
<p>The second argument of the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function is one of the following keywords:
<dl data-dfn-for=string() data-dfn-type=value>
<dt id=string-first><a class=self-link href=#string-first></a>first</dt>
<dd>The value of the first assignment on the page is used. If there is no assignment on the page, the <a class=css data-link-type=maybe href=#entry-value title="entry value">entry value</a> is used. <code>first</code> is the default value.</dd>
<dt id=string-start><a class=self-link href=#string-start></a>start</dt>
<dd>If the element is the first element on the page, the value of the first assignment is used. Otherwise the <a class=css data-link-type=maybe href=#entry-value title="entry value">entry value</a> is used. The <a class=css data-link-type=maybe href=#entry-value title="entry value">entry value</a> may be empty if the element hasn’t yet appeared. </dd>
<dt id=string-last><a class=self-link href=#string-last></a>last</dt>
<dd>The <a class=css data-link-type=maybe href=#exit-value title="exit value">exit value</a> of the named string is used.</dd>
<dt id=string-first-except><a class=self-link href=#string-first-except></a>first-except</dt>
<dd>This is identical to <code>first</code>, except that the empty string is used on the page where the value is assigned.</dd>
</dl>
<div class=example>
CSS:
<pre>@page {
size: 15cm 10cm;
margin: 1.5cm;
@top-left {
content: "first: " string(heading, first);
}
@top-center {
content: "start: " string(heading, start);
}
@top-right {
content: "last: " string(heading, last);
}
}
h2 { string-set: heading content() }
</pre><p>The following figures show the first, start, and last assignments of the “heading” string on various pages.
</p><figure>
<img alt="" src=using-strings-1.jpg width=480>
<figcaption>The <a href=#string-start>start</a> value is empty, as the string had not yet been set at the start of the page.</figcaption>
</figure>
<figure>
<img alt="" src=using-strings-2.jpg width=480>
<figcaption>Since the page starts with an h2, the <a href=#string-start>start</a> value is the value of that head.</figcaption>
</figure>
<figure>
<img alt="" src=using-strings-3.jpg width=480>
<figcaption>Since there’s not an h2 at the top of this page, the <a href=#string-start>start</a> value is the <a class=css data-link-type=maybe href=#exit-value title="exit value">exit value</a> of the previous page.</figcaption>
</figure>
</div>
<h3 class="heading settled heading" data-level=1.2 id=running-elements><span class=secno>1.2 </span><span class=content>
Running elements
</span><a class=self-link href=#running-elements></a></h3>
Many headers and footers cannot be represented only by unformatted text. A book title serving as a running head may contain an italic word, for example. A mechanism is needed to move or copy elements into margin boxes. To do this, we add the <a class=css data-link-type=maybe href=#funcdef-running title=running()>running()</a> value to the position property, and the <a class=css data-link-type=maybe href=#funcdef-element title=element()>element()</a> value to the content property.
<div class=example>
<pre>@page {
@top { content: element(header); }
}
h1 { position: running(header); }
</pre>
<p>In this example, the <code>h1</code> element is placed in the <code>@top</code> margin box, complete with formatting and any descendant elements. It does not display in the normal document flow.
</div>
<h4 class="heading settled heading" data-level=1.2.1 id=running-syntax><span class=secno>1.2.1 </span><span class=content>
The <a class=css data-link-type=maybe href=#funcdef-running title=running()>running()</a> value
</span><a class=self-link href=#running-syntax></a></h4>
<p><code>position: running(custom-ident)</code> removes the element (and associated ::before and ::after pseudo-elements) from the normal flow, and makes it available to place in a page margin box using <a class=css data-link-type=maybe href=#funcdef-element title=element()>element()</a>. The element inherits from its original position in the document, but does not display there.
<table class="definition propdef partial"><tr><th>Name:<td><a class=css-code data-link-type=property href=http://dev.w3.org/csswg/css-position-3/#position title=position>position</a><tr><th>New values:<td>running()<tr><th>Media:<td>paged</table>
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-running>running()<a class=self-link href=#funcdef-running></a></dfn> = string( <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> )
</pre>
<h4 class="heading settled heading" data-level=1.2.2 id=alternative-syntax-running><span class=secno>1.2.2 </span><span class=content>Alternative Proposal from Bert Bos</span><a class=self-link href=#alternative-syntax-running></a></h4>
<p>Bert Bos has proposed an alternative syntax, which allows both moving and copying elements into running heads. In the example below, h2 elements appear in their normal place in the document, but are also copied into running heads.
<div class=example>
<pre>
h2 {
display: block;
running: chapter;
font-size: 18pt;
font-weight: bold;
}
h2:running {
display: inline;
font-size: 11pt;
font-weight: normal;
font-variant: small-caps;
letter-spacing: 1pt;
}
@page {
@top-center {
content: element(chapter);
}
}
</pre></div>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-running>running<a class=self-link href=#propdef-running></a></dfn><tr><th>Value:<td><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a><tr><th>Initial:<td>none<tr><th>Applies to:<td>elements<tr><th>Inherited:<td>no<tr><th>Media:<td>all<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table>
<h4 class="heading settled heading" data-level=1.2.3 id=element-syntax><span class=secno>1.2.3 </span><span class=content>
The <a class=css data-link-type=maybe href=#funcdef-element title=element()>element()</a> value
</span><a class=self-link href=#element-syntax></a></h4>
<p>The <a class=css data-link-type=maybe href=#funcdef-element title=element()>element()</a> value of the content property places an element (which has been removed from the normal flow via <a class=css data-link-type=maybe href=#funcdef-running title=running()>running()</a>) in a page margin box. Whenever the value of the element changes, the value of <a class=css data-link-type=maybe href=#funcdef-element title=element()>element()</a> is updated.
<p>Just as with <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a>, <a class=css data-link-type=maybe href=#funcdef-element title=element()>element()</a> takes an optional keyword to describe which value should be used in the case of multiple assignments on a page. User agents must be able to recall many values, as <a class=css data-link-type=maybe href=#funcdef-element title=element()>element()</a> can return past, current, or future values of the assignment.
<table class="definition propdef partial"><tr><th>Name:<td><a class=css-code data-link-type=property href=http://dev.w3.org/csswg/css-content-3/#content title=content>content</a><tr><th>New values:<td>element()<tr><th>Media:<td>paged</table>
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-element>element()<a class=self-link href=#funcdef-element></a></dfn> = string( <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> [ , [ first | start | last | first-except] ]? )
</pre>
<div class=example>
<p>HTML:
<pre><p class="rh"><i>Miranda v. Arizona</i> in Context</p>
<h2><i>Miranda v. Arizona</i> in Context</h2>
</pre>
<p>CSS:
<pre> @top-center {
content: element(heading);
}
p.rh {
position: running(heading);
}
p.rh::before {
content: counter(page) ' / ';
}
</pre>
<figure>
<p><img alt="running header using running elements" src=running-element-gcpm_Page_1.jpg width=480>
</p><figcaption>Running element in page margin box</figcaption>
</figure>
</div>
<p class=note>The element <span class=css data-link-type=maybe title=value()>value()</span> can only be used in page margin boxes. And it cannot be combined with other possible values for the content property.</p>
<p class=issue id=issue-90b2f97a><a class=self-link href=#issue-90b2f97a></a>This idea would be much more useful if we could also copy (rather than just move) elements. That would avoid the duplication of HTML in the example above.</p>
<h2 class="heading settled heading" data-level=2 id=footnotes><span class=secno>2 </span><span class=content>
Footnotes
</span><a class=self-link href=#footnotes></a></h2>
Ancillary content may be moved to the bottom or side of a page. A footnote is created when such content moves to the bottom of the page, leaving a reference indicator.
<h3 class="heading settled heading" data-level=2.1 id=footnote-terms><span class=secno>2.1 </span><span class=content>Terminology</span><a class=self-link href=#footnote-terms></a></h3>
<p>Footnotes are complex objects (see the <a href=http://www.w3.org/TR/2014/WD-dpub-latinreq-20140313/#footnotes>footnote section</a> at <a data-biblio-type=informative data-link-type=biblio href=#dpub-latinreq title=dpub-latinreq>[dpub-latinreq]</a>), so it will be helpful to define some terms before proceeding.
</p><figure>
<p><img alt="page with footnotes" src=footnote-diagram.001.jpg width=480>
</p><figcaption>Footnote terminology</figcaption>
</figure>
<dl>
<dt>footnote element</dt>
<dd>The element containing the content of the footnote, which will be removed from the flow and displayed as a footnote.</dd>
<dt>footnote marker (also known as footnote number)</dt>
<dd>A number or symbol adjacent to the footnote body, identifying the particular footnote. The footnote marker should use the same number or symbol as the corresponding footnote call, although the marker may contain additional punctuation.</dd>
<dt>footnote body</dt>
<dd>The footnote marker is placed before the footnote element, and together they represent the footnote body, which will be placed in the footnote area.</dd>
<dt>footnote call (also known as footnote reference)</dt>
<dd>A number or symbol, found in the main text, which points to the footnote body.</dd>
<dt>footnote area</dt>
<dd>The page area used to display footnotes.</dd>
<dt>footnote rule (also known as footnote separator)</dt>
<dd>A horizontal rule is often used to separate the footnote area from the rest of the page. The separator (and the entire footnote area) cannot be rendered on a page with no footnotes.</dd>
</dl>
<h3 class="heading settled heading" data-level=2.2 id=creating-footnotes><span class=secno>2.2 </span><span class=content>
Creating footnotes
</span><a class=self-link href=#creating-footnotes></a></h3>
An element becomes a footnote by applying <code>float: footnote</code> to that element. This triggers the following actions:
<ol>
<li> The footnote element is removed from the flow, and a <code>::footnote-call</code> pseudo-element is inserted in its place, which serves as a reference to the footnote.</li>
<li> A <code>::footnote-marker</code> pseudo-element, identifying the footnote, is placed at the beginning of the footnote element. Together this is the footnote body.</li>
<li>The <a class=css data-link-type=maybe href=#footnote-counter title="footnote counter">footnote counter</a> is incremented.</li>
<li>The footnote body is placed in the footnote area at the bottom of the page. Footnote elements from a given page are placed in the footnote area of that page in document order.</li>
</ol>
<div class=example>
HTML:
<pre style="word-wrap: break-word; white-space: pre-wrap;"><p>Though the body was erect, the head was thrown back so that the closed eyes were pointed towards the needle of the tell-tale that swung from a beam in the ceiling.<span class="footnote">The cabin-compass is called the tell-tale, because without going to the compass at the helm, the Captain, while below, can inform himself of the course of the ship.</span></p>
</pre> <p>CSS:
<pre>@page {
@footnote {
float: bottom;
}
}
span.footnote { float: footnote; }
</pre> </div>
<p class=issue id=issue-4af1f674><a class=self-link href=#issue-4af1f674></a>Why is float:bottom used with the footnote area? Floating footnotes to the footnote area, and then floating the footnote area itself, seems overly complex, given that implementations don’t allow the footnote area to float anywhere else. Note that some implementations do allow the footnote area to be absolutely positioned.</p>
<h3 class="heading settled heading" data-level=2.3 id=footnote-types><span class=secno>2.3 </span><span class=content>
Types of footnotes
</span><a class=self-link href=#footnote-types></a></h3>
The following new value of the <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visuren.html#propdef-float title=float>float</a> property creates a footnote element:
<table class="definition propdef partial"><tr><th>Name:<td><a class=css-code data-link-type=property href=http://www.w3.org/TR/CSS21/visuren.html#propdef-float title=float>float</a><tr><th>New values:<td>footnote<tr><th>Media:<td>paged</table> <dl data-dfn-for=float data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=float data-dfn-type=value data-export="" id=valuedef-footnote>footnote<a class=self-link href=#valuedef-footnote></a></dfn></dt>
<dd>each footnote element is placed in the footnote area of the page</dd>
</dl>
<p>The <a class=property data-link-type=propdesc href=#propdef-footnote-display title=footnote-display>footnote-display</a> property determines whether a footnote is displayed as a block element or inline element.
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-footnote-display>footnote-display<a class=self-link href=#propdef-footnote-display></a></dfn><tr><th>Value:<td>block | inline | compact<tr><th>Initial:<td>block<tr><th>Applies to:<td>elements<tr><th>Inherited:<td>no<tr><th>Media:<td>paged<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table>
<dl data-dfn-for=footnote-display data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=footnote-display data-dfn-type=value data-export="" id=footnote-display-block>block<a class=self-link href=#footnote-display-block></a></dfn></dt>
<dd>The footnote element is placed in the footnote area as a block element</dd>
<dt><dfn class=css-code data-dfn-for=footnote-display data-dfn-type=value data-export="" id=footnote-display-inline>inline<a class=self-link href=#footnote-display-inline></a></dfn></dt>
<dd>The footnote element is placed in the footnote area as an inline element</dd>
<dt><dfn class=css-code data-dfn-for=footnote-display data-dfn-type=value data-export="" id=footnote-display-compact>compact<a class=self-link href=#footnote-display-compact></a></dfn></dt>
<dd>The user agent determines whether a given footnote element is placed as a block element or an inline element. If two or more footnotes could fit on the same line in the footnote area, they should be placed inline.</dd>
</dl>
<h3 class="heading settled heading" data-level=2.4 id=footnote-area><span class=secno>2.4 </span><span class=content>
The footnote area
</span><a class=self-link href=#footnote-area></a></h3>
A <a href=http://dev.w3.org/csswg/css-page/#page-area>page area</a> that can be used to display footnotes is described in the <a href=http://dev.w3.org/csswg/css-page/#page-context>page context</a> using an <code>@footnote</code> rule. This rule defines a box that, if used, will contain all the footnote elements that appear on that page.
<p class=issue id=issue-829ce977><a class=self-link href=#issue-829ce977></a>How would one describe this in the grammar of CSS3-Page?</p>
<h4 class="heading settled heading" data-level=2.4.1 id=footnote-area-position><span class=secno>2.4.1 </span><span class=content>Positioning of the footnote area</span><a class=self-link href=#footnote-area-position></a></h4>
The bottom margin edge of the footnote area is positioned so that it touches the bottom of the page area. The footnote area can only contain footnotes.
<p class=issue id=issue-165f8769><a class=self-link href=#issue-165f8769></a>Implementations that support footnotes generally support page floats like <code>float: bottom</code>. Page floats should end up above the footnote area. How might this be specified?</p>
<h4 class="heading settled heading" data-level=2.4.2 id=footnote-area-size><span class=secno>2.4.2 </span><span class=content>Size of the footnote area</span><a class=self-link href=#footnote-area-size></a></h4>
<p>The <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-max-height title=max-height>max-height</a> property on the footnote area limits the size of this area, unless the page contains only footnotes (as may happen on the last page of a document).
<p>Since it is undesirable for a page to consist only of footnotes, user agents <em class=RFC2119>may</em> set a default max-height value on the footnote area.
<h3 class="heading settled heading" data-level=2.5 id=footnote-counters><span class=secno>2.5 </span><span class=content>The Footnote Counter</span><a class=self-link href=#footnote-counters></a></h3>
<p>The <dfn data-dfn-type=dfn data-noexport="" id=footnote-counter>footnote counter<a class=self-link href=#footnote-counter></a></dfn> is a predefined <a href=http://dev.w3.org/csswg/css-lists/#counter>counter</a> associated with the footnote element. Its value is the number or symbol used to identify the footnote. This value is used in both the footnote call and the footnote marker. It should be incremented for each footnote.
<h4 class="heading settled heading" data-level=2.5.1 id=footnote-counter-values><span class=secno>2.5.1 </span><span class=content>Values of the footnote counter</span><a class=self-link href=#footnote-counter-values></a></h4>
<p>The footnote counter, like other counters, may use any <a href=http://dev.w3.org/csswg/css-counter-styles-3/#counter-style>counter style</a>. Footnotes often use a sequence of symbols.
<div class=example>
<pre>::footnote-call { content: counter(footnote, symbols('*', '†', '‡', '§')); }
::footnote-marker { content: counter(footnote, symbols('*', '†', '‡', '§')) '. '; }
</pre>
</div>
<h4 class="heading settled heading" data-level=2.5.2 id=resetting-footnote-counter><span class=secno>2.5.2 </span><span class=content>Resetting the footnote counter</span><a class=self-link href=#resetting-footnote-counter></a></h4>
<p>The footnote counter may be reset on each page.
<div class=example>
<pre>@page {
counter-reset: footnote;
@footnote { … }
}
</pre></div>
<p>Note that the value of the footnote counter should depend on the position of the footnote element in the document tree, not where it is eventually placed. A footnote element may sometimes be placed on the page after the footnote call, but the same counter value must be used for both.
<h3 class="heading settled heading" data-level=2.6 id=footnote-call><span class=secno>2.6 </span><span class=content>
The <code>footnote-call</code> pseudo-element
</span><a class=self-link href=#footnote-call></a></h3>
A <code>::footnote-call</code> pseudo-element is inserted in place of the footnote element when the latter is removed from the flow. By default, the content of this pseudo-element is the value of the footnote counter, styled as a superscripted number.
<div class=example>
<pre>::footnote-call {
content: counter(footnote);
vertical-align: baseline;
font-size: 100%;
line-height: inherit;
font-variant-position: super;
}
</pre> </div>
<h3 class="heading settled heading" data-level=2.7 id=footnote-marker><span class=secno>2.7 </span><span class=content>
The <code>footnote-marker</code> pseudo-element
</span><a class=self-link href=#footnote-marker></a></h3>
The <code>::footnote-marker</code> pseudo-element represents the footnote element’s marker, the number or symbol that identifies each footnote. This pseudo-element behaves like a <code>::marker</code> pseudo-element, as defined in <a data-biblio-type=informative data-link-type=biblio href=#css3list title=css3list>[CSS3LIST]</a>. It is placed at the beginning of the superior parent’s content, and is inline by default. The <code>::footnote-marker</code> can be styled just as other <code>::marker</code> elements can be. The default style should include <code>list-style-position: inside</code>.
<div class=example>
<pre>::footnote-marker {
content: counter(footnote);
}
::footnote-marker::after {
content: '. ';
}
</pre> </div>
<h3 class="heading settled heading" data-level=2.8 id=footnote-policy><span class=secno>2.8 </span><span class=content>
Rendering footnotes and <code>footnote policy</code>
</span><a class=self-link href=#footnote-policy></a></h3>
<p>Rendering footnotes can be complex. If a footnote falls near the bottom of the page, there may not be enough room on the page for the footnote body. The <a class=property data-link-type=propdesc href=#propdef-footnote-policy title=footnote-policy>footnote-policy</a> property allows authors some influence over the rendering of difficult pages.
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-footnote-policy>footnote-policy<a class=self-link href=#propdef-footnote-policy></a></dfn><tr><th>Value:<td>auto | line | block<tr><th>Initial:<td>auto<tr><th>Applies to:<td>elements<tr><th>Inherited:<td>no<tr><th>Media:<td>paged<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table>
<dl data-dfn-for=footnote-policy data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=footnote-policy data-dfn-type=value data-export="" id=valuedef-auto>auto<a class=self-link href=#valuedef-auto></a></dfn></dt>
<dd>The user agent chooses how to render footnotes, and may place the footnote body on a later page than the footnote reference. A footnote body must never be placed on a page before the footnote reference.</dd>
<dt><dfn class=css-code data-dfn-for=footnote-policy data-dfn-type=value data-export="" id=footnote-policy-line>line<a class=self-link href=#footnote-policy-line></a></dfn></dt>
<dd>If a given footnote body cannot be placed on the current page due to lack of space, the user agent introduces a forced page break at the start of the line containing the footnote reference, so that both the reference and the footnote body fall on the next page. Note that the user agent must honor <a href=http://dev.w3.org/csswg/css-break/#widows-orphans>widow and orphan</a> settings when doing this, and so may need to insert the page break on an earlier line.</dd>
<dt><dfn class=css-code data-dfn-for=footnote-policy data-dfn-type=value data-export="" id=valuedef-block>block<a class=self-link href=#valuedef-block></a></dfn></dt>
<dd>As with <a href=#footnote-policy-line>line</a>, except a forced page break is introduced before the paragraph that contains the footnote.</dd>
</dl>
<p class=issue id=issue-da883bb8><a class=self-link href=#issue-da883bb8></a>We need an algorithm for laying out footnotes</p>
<h3 class="heading settled heading" data-level=2.9 id=future><span class=secno>2.9 </span><span class=content>
Future directions
</span><a class=self-link href=#future></a></h3>
The next level will include sidenotes, column footnotes, and multiple footnote areas.
<h2 class="heading settled heading" data-level=3 id=page-selectors><span class=secno>3 </span><span class=content>
Selecting Pages
</span><a class=self-link href=#page-selectors></a></h2>
A paginated document consists of a sequence of pages. [[CSS3PAGE]] defines <dfn data-dfn-type=dfn data-noexport="" id=page-selectors0>page selectors<a class=self-link href=#page-selectors0></a></dfn>, which allow the selection of the first page of the document, left and right pages, and blank pages. Here we extend the idea of page selectors to enable the selection of arbitrary document pages.
<h3 class="heading settled heading" data-level=3.1 id=document-page-selectors><span class=secno>3.1 </span><span class=content>
Page Selectors
</span><a class=self-link href=#document-page-selectors></a></h3>
The <a class=css data-link-type=maybe href=#funcdef-nth title=nth()>nth()</a> page pseudo-class allows the selection of arbitrary document pages. This pseudo-class takes an argument of the form <a href=http://dev.w3.org/csswg/css-syntax/#anb>An + B</a> as defined in <a data-biblio-type=informative data-link-type=biblio href=#css3syn title=css3syn>[CSS3SYN]</a>. When applied to the default @page rule, <a class=css data-link-type=maybe href=#funcdef-nth title=nth()>nth()</a> selects the document page whose index matches the argument.
<pre class=prod><dfn class=css-code data-dfn-type=function data-export="" id=funcdef-nth>nth()<a class=self-link href=#funcdef-nth></a></dfn> = ( An+B [of <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a>]?)
</pre>
<p class=note>
<a class=css data-link-type=maybe href=#funcdef-nth title=nth()>nth()</a> is not related to the page counter, which may reset and use various numbering schemes.</p>
<p>When the <a class=css data-link-type=maybe href=#funcdef-nth title=nth()>nth()</a> selector is applied to a named page, and that named page is part of a page-group (see below), it selects the nth page in the page group.
<div class=example>
<pre>@page :nth(1)
</pre> This selects the first page of the document. <pre>@page :nth(2n)
</pre> This selects all even document pages.
</div>
<h3 class="heading settled heading" data-level=3.2 id=document-sequence-selectors><span class=secno>3.2 </span><span class=content>
Page groups
</span><a class=self-link href=#document-sequence-selectors></a></h3>
Many paginated documents have a repeating structure, consisting of many chapters, sections, or articles. The first page of each subdivision often requires special treatment, but <a data-biblio-type=informative data-link-type=biblio href=#css3page title=css3page>[CSS3PAGE]</a> doesn’t define a way to select the first page of each chapter (as distinct from the first page of the entire document).
<p>When the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-page-3/#propdef-page title=page>page</a> property is applied to an element, a <a class=css data-link-type=maybe href=#page-group title="page group">page group</a> is created. The <dfn data-dfn-type=dfn data-noexport="" id=page-group>page group<a class=self-link href=#page-group></a></dfn> is the collection of all pages created by an instance of that element. When a new instance of the element is rendered, a new <a class=css data-link-type=maybe href=#page-group title="page group">page group</a> is started.
<p>A page may be part of several page groups, as a given <a class=css data-link-type=maybe href=#page-group title="page group">page group</a> may have ancestors or descendants that are part of another <a class=css data-link-type=maybe href=#page-group title="page group">page group</a>.
<div class=example>
CSS:
<pre>div { page: A }
child { page: B }
</pre><figure>
<img alt="" src=PageGroups.001.jpg width=480>
<figcaption>A page may be part of several page groups.</figcaption>
</figure>
Note that page 5 can be selected in three ways:
<pre>@page :nth(5 of A) /* will select 5th page of every <div> */
@page :nth(1 of B) /* will select first page of every <child> */
@page :nth(5) /* will select 5th page of document */
</pre></div>
<div class=example>
<p>Consider the following HTML:
<pre>
<div class="chapter">
<h1>Chapter One</h1>
<p>some text</p>
<table class="broadside">
...
</table>
...
</div>
<div class="chapter">
<h1>Chapter Two</h1>
<p>some text</p>
...
<table class="broadside">
...
</table>
...
</div>
</pre>
<p>And CSS:
<pre>div.Chapter {
page: body;
}
div.broadside {
page: broadside;
}
</pre>
<p>In this case, each chapter will form a separate page group. @page:nth(3 of body) will select the third page of each chapter, even if that page happens to use the “broadside” named page. @page:nth(1) will select only the first page of the document, as will @page:first.
</div>
<h2 class="heading settled heading" data-level=4 id=leaders><span class=secno>4 </span><span class=content>
Leaders
</span><a class=self-link href=#leaders></a></h2>
A leader, sometimes known as a tab leader or a dot leader, is a repeating pattern used to visually connect content across horizontal spaces. They are most commonly used in tables of contents, between titles and page numbers. The <a class=css data-link-type=maybe href=#funcdef-leader title=leader()>leader()</a> function, as a value for the content property, is used to create leaders in CSS. This function takes a string (the leader string), which describes the repeating pattern for the leader.
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-leader>leader()<a class=self-link href=#funcdef-leader></a></dfn> = leader( [dotted | solid | space] | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a>);
</pre>
<p>Three keywords are shorthand values for common strings:
<dl>
<dt id=dotted-leader><a class=self-link href=#dotted-leader></a>dotted</dt>
<dd>leader('. ')</dd>
<dt id=solid-leader><a class=self-link href=#solid-leader></a>solid</dt>
<dd>leader('_')</dd>
<dt id=space-leader><a class=self-link href=#space-leader></a>space</dt>
<dd>leader(' ')</dd>
<dt id=string-leader><a class=self-link href=#string-leader></a><string></dt>
<dd></dd>
</dl>
<div class=example>
<pre>
ol.toc a::after {
content: leader('.') target-counter(attr(href url), page);
}
<h1>Table of Contents</h1>
<ol class="toc">
<li><a href="#chapter1">Loomings</a></li>
<li><a href="#chapter2">The Carpet-Bag</a></li>
<li><a href="#chapter3">The Spouter-Inn</a></li>
</ol>
</pre> This might result in: <pre>Table of Contents
<p>1. Loomings.....................1
2. The Carpet-Bag...............9
3. The Spouter-Inn.............13
</pre>
</div>
<p class=issue id=issue-2f5c8d3f><a class=self-link href=#issue-2f5c8d3f></a>
Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)?
</p>
<h3 class="heading settled heading" data-level=4.1 id=rendering-leaders><span class=secno>4.1 </span><span class=content>
Rendering leaders
</span><a class=self-link href=#rendering-leaders></a></h3>
Consider a line which contains the content before the leader (the “before content”), the leader, and the content after the leader (the “after content”). Leaders obey the following rules:
<ol>
<li>The leader string must appear in full at least once. </li>
<li>The leader should be as long as possible</li>
<li>Visible characters in leaders should vertically align with each other when possible.</li>
<li>Line break characters in the leader string must be ignored.</li>
<li>White space in the leader string follows normal CSS rules.</li>
<li>A leader only appears between the start content and the end content.</li>
<li>A leader only appears on a single line, even if the before content and after content are on different lines. </li>
<li>A leader can’t be the only thing on a line. </li>
</ol>
<h4 class="heading settled heading" data-level=4.1.1 id=procedure-leader><span class=secno>4.1.1 </span><span class=content>
Procedure for rendering leaders
</span><a class=self-link href=#procedure-leader></a></h4>
<ol>
<li> Lay out the before content, until reaching the line where the before content ends. <pre>BBBBBBBBBB
BBB
</pre> </li>
<li> The leader string consists of one or more glyphs, and is thus an inline box. A leader is a row of these boxes, drawn from the end edge to the start edge, where only those boxes not overlaid by the before or after content. On this line, draw the leader string, starting from the end edge, repeating as many times as possible until reaching the start edge. <pre>BBBBBBBBBB
..........
</pre> </li>
<li> Draw the before and after content on top of the leader. If any part of the before or after content overlaps a glyph in a leader string box, that glyph is not displayed.<pre>BBBBBBBBBB
BBB....AAA
</pre> </li>
<li> If one full copy of the leader string is not visible: <pre>BBBBBBB
BBBBBBA
</pre> Insert a line break before the after content, draw the leader on the next line, and draw the end content on top <pre>BBBBBBB
BBBBBB
......A
</pre> </li>
</ol>
<figure>
<img alt="drawing leaders" src=leader.001.jpg width=480>
<figcaption>Procedure for drawing leaders</figcaption>
</figure>
<figure>
<img alt="drawing leaders" src=leader.002.jpg width=480>
<figcaption>Procedure for drawing leaders when the content doesn’t fit on a single line</figcaption>
</figure>
<h2 class="heading settled heading" data-level=5 id=xref><span class=secno>5 </span><span class=content>
Cross-references
</span><a class=self-link href=#xref></a></h2>
Many documents contain internal references:
<ul>
<li> See chapter 7 </li>
<li> in section 4.1 </li>
<li> on page 23 </li>
</ul>
Three new values for the content property are used to automatically create these types of cross-references: <a class=css data-link-type=maybe href=#funcdef-target-counter title=target-counter()>target-counter()</a>, <a class=css data-link-type=maybe href=#funcdef-target-counters title=target-counters()>target-counters()</a>, and <a class=css data-link-type=maybe href=#target-text-function title=target-text()>target-text()</a>. Each of these displays information obtained from the target end of a link.
<h3 class="heading settled heading" data-level=5.1 id=target-counter><span class=secno>5.1 </span><span class=content>
The <a class=css data-link-type=maybe href=#funcdef-target-counter title=target-counter()>target-counter()</a> function
</span><a class=self-link href=#target-counter></a></h3>
The <a class=css data-link-type=maybe href=#funcdef-target-counter title=target-counter()>target-counter()</a> function retrieves the value of the innermost counter with a given name. The required arguments are the url of the target and the name of the counter. An optional counter-style argument can be used to format the result.
<p class=note>These functions only take a fragment URL which points to a location in the current document. If there’s no fragment, if the ID referenced isn’t there, or if the URL points to an outside document, the user agent must treat that as an error.</p>
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-target-counter>target-counter()<a class=self-link href=#funcdef-target-counter></a></dfn> = target-counter( <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#url-value title="<url>"><url></a> , <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> [ , <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-counter-styles-3/#typedef-counter-style title="<counter-style>"><counter-style></a> ]? )
</pre> <div class=example>
HTML:
<pre>…which will be discussed on page <a href="#chapter4_sec2">000</a>.
</pre><p>CSS:
<pre>a::after { content: target-counter(attr(href url), page) }
</pre> <p>Result:
<pre>…which will be discussed on page 137.
</pre></div>
<div class=example>
Page numbers in tables of contents can be generated automatically:
<p>HTML:
<pre><nav>
<ol>
<li class="frontmatter"><a href="#pref_01">Preface</a></li>
<li class="frontmatter"><a href="#intr_01">Introduction</a></li>
<li class="bodymatter"><a href="#chap_01">Chapter One</a></li>
</ol>
</nav>
</pre>
<p>CSS:
<pre>.frontmatter a::after { content: leader('.') target-counter(attr(href url), page, lower-roman) }
.bodymatter a::after { content: leader('.') target-counter(attr(href url), page, decimal) }
</pre>
<p>Result:
<pre>Preface.............vii
Introduction.........xi
Chapter One...........1
</pre>
</div>
<h3 class="heading settled heading" data-level=5.2 id=target-counters><span class=secno>5.2 </span><span class=content>
The <a class=css data-link-type=maybe href=#funcdef-target-counters title=target-counters()>target-counters()</a> function
</span><a class=self-link href=#target-counters></a></h3>
This functions fetches the value of all counters of a given name from the end of a link, and formats them by inserting a given string between the value of each nested counter.
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-target-counters>target-counters()<a class=self-link href=#funcdef-target-counters></a></dfn> = target-counter( <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#url-value title="<url>"><url></a> , <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> , <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> [ , <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-counter-styles-3/#typedef-counter-style title="<counter-style>"><counter-style></a> ]? )
</pre>
<div class=example>
<pre>I have not found a compelling example for target-counters() yet.
</pre>
</div>
<h3 class="heading settled heading" data-level=5.3 id=target-text><span class=secno>5.3 </span><span class=content>
target-text
</span><a class=self-link href=#target-text></a></h3>
The <a class=css data-link-type=maybe href=#target-text-function title=target-text()>target-text()</a> function retrieves the text value of the element referred to by the URL. An optional second argument specifies what content is retrieved, using the same values as the <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property above.
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=target-text-function>target-text()<a class=self-link href=#target-text-function></a></dfn> = target-counter( <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#url-value title="<url>"><url></a> [ , [ content | before | after | first-letter] ]? )
</pre>
<p class=issue id=issue-a82075c9><a class=self-link href=#issue-a82075c9></a>A simpler syntax has been proposed by fantasai: http://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html</p>
<div class=example>
<pre>…which will be discussed <a href="#chapter_h1_1">later</a>.
a::after { content: ", in the chapter entitled " target-text(attr(href url)) }
</pre> Result: …which will be discussed later, in the chapter entitled Loomings. </div>
<h2 class="heading settled heading" data-level=6 id=bookmarks><span class=secno>6 </span><span class=content>
Bookmarks
</span><a class=self-link href=#bookmarks></a></h2>
Some document formats, most notably PDF, allow the use of <dfn data-dfn-type=dfn data-noexport="" id=bookmarks0>bookmarks<a class=self-link href=#bookmarks0></a></dfn> as an aid to navigation. Bookmarks provide a hierarchy of links to document sections, as well as text to label the links. A bookmark has three properties: <a class=property data-link-type=propdesc href=#propdef-bookmark-level title=bookmark-level>bookmark-level</a>, <a class=property data-link-type=propdesc href=#propdef-bookmark-label title=bookmark-label>bookmark-label</a>, and <a class=property data-link-type=propdesc href=#propdef-bookmark-state title=bookmark-state>bookmark-state</a>.
<h3 class="heading settled heading" data-level=6.1 id=bookmark-level><span class=secno>6.1 </span><span class=content>
bookmark-level
</span><a class=self-link href=#bookmark-level></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-bookmark-level>bookmark-level<a class=self-link href=#propdef-bookmark-level></a></dfn><tr><th>Value:<td>none | <integer><tr><th>Initial:<td>none<tr><th>Applies to:<td>all elements<tr><th>Inherited:<td>no<tr><th>Media:<td>paged<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table> <dl data-dfn-for=bookmark-level data-dfn-type=value>
<dt><integer></dt>
<dd>defines the level of the bookmark, with the highest level being 1 (negative and zero values are invalid). </dd>
<dt>none</dt>
<dd>no bookmark is generated.</dd>
</dl>
<div class=example>
<pre>section h1 { bookmark-level: 1; }
section section h1 { bookmark-level: 2; }
section section section h1 { bookmark-level: 3; }
</pre>
</div>
<h3 class="heading settled heading" data-level=6.2 id=bookmark-label><span class=secno>6.2 </span><span class=content>
bookmark-label
</span><a class=self-link href=#bookmark-label></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-bookmark-label>bookmark-label<a class=self-link href=#propdef-bookmark-label></a></dfn><tr><th>Value:<td><content-list> | none<tr><th>Initial:<td>none<tr><th>Applies to:<td>all elements<tr><th>Inherited:<td>no<tr><th>Media:<td>paged<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table> <dl data-dfn-for=bookmark-label data-dfn-type=value>
<dt><content-list></dt>
<dd><a href=#content-list><content-list></a> is defined above, in the section on the <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property. The value of <a href=#content-list><content-list></a> becomes the text content of the bookmark label.</dd>
<dt>none</dt>
<dd>no bookmark is generated.</dd>
</dl>
<div class=example>
HTML:
<pre><h1>Loomings</h1>
</pre><p>CSS:
<pre>h1 { bookmark-label: content(text); }
</pre><p>The bookmark label will be “Loomings”.
</div>
<h3 class="heading settled heading" data-level=6.3 id=bookmark-state><span class=secno>6.3 </span><span class=content>
bookmark-state
</span><a class=self-link href=#bookmark-state></a></h3>
Bookmarks typically toggle open and closed, with the open state displaying the next level of bookmarks.
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-bookmark-state>bookmark-state<a class=self-link href=#propdef-bookmark-state></a></dfn><tr><th>Value:<td>open | closed<tr><th>Initial:<td>open<tr><th>Applies to:<td>block-level elements<tr><th>Inherited:<td>no<tr><th>Media:<td>paged<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table> <dl data-dfn-for=bookmark-state data-dfn-type=value>
<dt>open</dt>
<dd>The bookmarks of the nearest descendants of an element with a bookmark-state of open will be displayed.</dd>
<dt>closed</dt>
<dd>any bookmarks of descendant elements are not initially displayed.</dd>
</dl>
<h2 class="no-num heading settled heading" id=ua-stylesheet><span class=content>Appendix A: Default UA Stylesheet</span><a class=self-link href=#ua-stylesheet></a></h2>
<p>This appendix is informative, and is to help UA developers to implement a default stylesheet for HTML, but UA developers are free to ignore or modify as appropriate. </p>
<div class=example>
<pre>@page {
counter-reset: footnote;
@footnote {
counter-increment: footnote;
float: bottom;
column-span: all;
height: auto;
}
}
::footnote-marker {
content: counter(footnote);
list-style-position: inside;
}
::footnote-marker::after {
content: '. ';
}
::footnote-call {
content: counter(footnote);
vertical-align: super;
font-size: 65%;
}
@supports ( font-variant-position: super ) {
::footnote-call {
content: counter(footnote);
vertical-align: baseline;
font-size: 100%;
line-height: inherit;
font-variant-position: super;
}
}
h1 { bookmark-level: 1 }
h2 { bookmark-level: 2 }
h3 { bookmark-level: 3 }