forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverview.bs
1059 lines (767 loc) · 37.1 KB
/
Overview.bs
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
<pre class='metadata'>
Title: CSS Generated Content for Paged Media Module
Status: WD
Date: 2024-01-25
Prepare for TR: yes
Work Status: Exploring
Shortname: css-gcpm
Level: 3
Group: csswg
ED: https://drafts.csswg.org/css-gcpm/
TR: https://www.w3.org/TR/css-gcpm-3/
Editor: Mike Bremford, BFO, mike@bfo.com, w3cid 118053
Editor: Rachel Andrew, Google, rachelandrew@google.com, w3cid 81117
Former Editor: Dave Cramer, Hachette Livre, dave.cramer@hbgusa.com, w3cid 65283
Former Editor: Håkon Wium Lie, Opera Software
Link defaults: css-content-3 (property) counter-increment, css-content-3 (property) counter-reset, css21 (property) string, css2 (property) max-height
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.
Ignored Terms:
</pre>
<pre class="link-defaults">
spec:css-content-3; type:function; text:string()
spec:css-content-3; type:property; text:bookmark-label
spec:css-content-3; type:property; text:bookmark-level
</pre>
<h2 class="no-num" id="introduction">
Introduction
</h2>
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.
This module defines new properties and values, so that authors may bring these techniques to paged media.
<h3 id="values">
Value Definitions</h3>
This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS21]]
using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
Value types not defined in this specification are defined in CSS Values & Units [[!CSS-VALUES-3]].
Combination with other CSS modules may expand the definitions of these value types.
In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the <a>CSS-wide keywords</a> as their property value.
For readability they have not been repeated explicitly.
<!--page areas-->
<h2 id="running-headers-and-footers">
Running headers and footers
</h2>
[[CSS3PAGE]] describes the sixteen page margin boxes which can be used for running headers and footers, but does not describe a mechanism for inserting content in those boxes. This module provides two methods for doing so. <dfn lt="named string">Named strings</dfn> copy text for reuse in margin boxes. <dfn id="running-elements0">Running elements</dfn> move elements (complete with style and structure) from the document to margin boxes.
<h3 id="named-strings">
Named strings
</h3>
The 'string-set' property copies the text content of an element into a ''named string'', which functions as a variable. The text content of this named string can be retrieved using the ''string()'' function. Since these variables may change on a given page, an optional second value for the ''string()'' function allows authors to choose which value on a page is used.
<h4 id="setting-named-strings-the-string-set-pro">
The string-set property
</h4>
<pre class="propdef">
Name: string-set
Value: [ <<custom-ident>> <<content-list>> ]# | none
Initial: none
Applies to: all elements, but not pseudo-elements
Inherited: no
Percentages: N/A
Computed value: specified value
Animation type: discrete
</pre>
<p class=all-media>User agents are expected to support this property on all media, including non-visual ones.</p>
The 'string-set' property contains one or more pairs, each consisting of an custom identifier (the name of the named string) followed by a <<content-list>> describing how to construct the value of the named string.
<<content-list>> expands to one or more of the following values, in any order.
<pre class="prod">
<dfn id="content-list"><content-list></dfn> = [ <<string>> | <<counter()>> | <<counters()>> | <<content()>> | <<attr()>> ]+
</pre>
<dl dfn-type="value" dfn-for="<content-list>">
<dt><<string>>
<dd>A <a href="https://www.w3.org/TR/CSS21/syndata.html#strings">string</a>, as defined in [[CSS21]]
<dt><<counter()>>
<dd>A <a href="https://www.w3.org/TR/CSS21/syndata.html#counter">counter()</a> function, as described in [[CSS21]].
<dt><<counters()>>
<dd>A <a href="https://www.w3.org/TR/CSS21/syndata.html#counter">counters()</a> function, as described in [[CSS21]].
<dt><<content()>>
<dd>The ''content()'' function, described below.
<dt><<attr()>>
<dd>An ''attr()'' function, as defined in [[CSS-VALUES-3]]
</dl>
<h5 id="content-function-header">The ''content()'' function</h5>
<pre class="prod">
<dfn>content()</dfn> = content([text | before | after | first-letter ])
</pre>
<p class="issue">How do we define the default value for this function?</p>
<dl dfn-type="value" dfn-for="content()">
<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="https://www.w3.org/TR/css3-selectors/#first-letter">::first-letter</a></code> pseudo-element </dd>
</dl>
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>entry value</dfn> for a page is the assignment in effect at the end of the previous page. The <dfn>exit value</dfn> for a page is the assignment in effect at the end of the current page.
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 ''string()'' function can return past, current, or future values of the assignment.
<div class="example">
HTML:
<pre>
<h1>Loomings</h1>
</pre>
CSS:
<pre>
h1::before { content: 'Chapter ' counter(chapter); }
h1 { string-set: header content(before) ':' content(text); }
h1::after { content: '.'; }
</pre>
The value of the named string “header” will be “Chapter 1: Loomings”.
</div>
<div class="example">
HTML:
<pre>
<section title="Loomings">
</pre>
CSS:
<pre>
section { string-set: header attr(title) }
</pre>
The value of the “header” string will be “Loomings”.
</div>
<h4 id="using-named-strings">
The ''string()'' function
</h4>
The ''string()'' function is used to copy the value of a named string to the document, via the 'content' 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.
The second argument of the ''string()'' function is one of the following keywords:
<dl dfn-type="value" dfn-for="string()">
<dt id="string-first">first</dt>
<dd>The value of the first assignment on the page is used. If there is no assignment on the page, the ''entry value'' is used. <code>first</code> is the default value.</dd>
<dt id="string-start">start</dt>
<dd>If the element is the first element on the page, the value of the first assignment is used. Otherwise the ''entry value'' is used. The ''entry value'' may be empty if the element hasn’t yet appeared. </dd>
<dt id="string-last">last</dt>
<dd>The ''exit value'' of the named string is used.</dd>
<dt id="string-first-except">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>
The following figures show the first, start, and last assignments of the “heading” string on various pages.
<figure>
<img src="images/using-strings-1.jpg" width="480" alt="">
<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 src="images/using-strings-2.jpg" width="480" alt="">
<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 src="images/using-strings-3.jpg" width="480" alt="">
<figcaption>Since there’s not an h2 at the top of this page, the <a href="#string-start">start</a> value is the ''exit value'' of the previous page.</figcaption>
</figure>
</div>
<!--
<div class="example">
<pre>
Example where element fragments across page boundary
</pre>
</div>
-->
<h3 id="running-elements">
Running elements
</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 ''running()'' value to the position property, and the ''element()'' value to the content property.
<div class="example">
<pre>
@page {
@top { content: element(header); }
}
h1 { position: running(header); }
</pre>
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 id="running-syntax">
The ''running()'' value
</h4>
<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 ''element()''. The element inherits from its original position in the document, but does not display there.
<pre class="propdef partial">
Name: position
New Values: <<running()>>
</pre>
<pre class="prod">
<dfn>running()</dfn> = running( <<custom-ident>> )
</pre>
<!--
<h4 id="alternative-syntax-running">Alternative Proposal from Bert Bos</h4>
-->
<div class="example">
HTML:
<pre>
<p class="rh"><i>Miranda v. Arizona</i> in Context</p>
<h2><i>Miranda v. Arizona</i> in Context</h2>
</pre>
CSS:
<pre>
@top-center {
content: element(heading);
}
p.rh {
position: running(heading);
}
p.rh::before {
content: counter(page) ' / ';
}
</pre>
<figure>
<img src="images/running-element-gcpm_Page_1.jpg" width="480" alt="running header using running elements">
<figcaption>Running element in page margin box</figcaption>
</figure>
</div>
<p class="note">The ''element()'' value can only be used in page margin boxes. And it cannot be combined with other possible values for the content property.</p>
<div class="issue">
<p>This idea would be much more useful if we could also copy (rather than just move) elements. That would avoid the duplication of HTML in the example above.
</p>
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>
<pre class="propdef">
Name: running
Value: <<custom-ident>>
Initial: none
Applies to: elements
Inherited: no
Percentages: N/A
Computed value: specified value
Animation type: discrete
</pre>
<p class=all-media>User agents are expected to support this property on all media, including non-visual ones.</p>
</div>
<h4 id="element-syntax">
The ''element()'' value
</h4>
The ''element()'' value of the content property places an element (which has been removed from the normal flow via ''running()'') in a page margin box. Whenever the value of the element changes, the value of ''element()'' is updated.
Just as with ''string()'', ''element()'' 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 ''element()'' can return past, current, or future values of the assignment.
<pre class="propdef partial">
Name: content
New Values: <<element()>>
</pre>
<pre class="prod">
<dfn>element()</dfn> = element( <<custom-ident>> , [ first | start | last | first-except ]? )
</pre>
<h2 id="footnotes">
Footnotes
</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 id="footnote-terms">Terminology</h3>
Footnotes are complex objects (see the <a href="https://www.w3.org/TR/dpub-latinreq/#footnotes">footnote section</a> at [[dpub-latinreq]]), so it will be helpful to define some terms before proceeding.
<figure>
<img src="images/footnote-diagram.001.jpg" width="480" alt="page with footnotes">
<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 id="creating-footnotes">
Creating footnotes
</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 ''footnote counter'' 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>
CSS:
<pre>
@page {
@footnote {
float: bottom;
}
}
span.footnote { float: footnote; }
</pre>
</div>
<p class="issue">Why is float:bottom used with the footnote area? Floating footnotes to the footnote area, and then floating the footnote area itself, seems overly complex, given that implementations don’t allow the footnote area to float anywhere else. Note that some implementations do allow the footnote area to be absolutely positioned.</p>
<h3 id="footnote-types">
Types of footnotes
</h3>
The following new value of the 'float' property creates a footnote element:
<pre class="propdef partial">
Name: float
New Values: footnote
</pre>
<dl dfn-type="value" dfn-for="float">
<dt><dfn>footnote</dfn></dt>
<dd>each footnote element is placed in the footnote area of the page</dd>
</dl>
The 'footnote-display' property determines whether a footnote is displayed as a block element or inline element.
<pre class="propdef">
Name: footnote-display
Value: block | inline | compact
Initial: block
Applies to: elements
Inherited: no
Percentages: N/A
Computed value: specified value
Animation type: discrete
</pre>
<dl dfn-type="value" dfn-for="footnote-display">
<dt><dfn id="footnote-display-block">block</dfn></dt>
<dd>The footnote element is placed in the footnote area as a block element</dd>
<dt><dfn id="footnote-display-inline">inline</dfn></dt>
<dd>The footnote element is placed in the footnote area as an inline element</dd>
<dt><dfn id="footnote-display-compact">compact</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 id="footnote-area">
The footnote area
</h3>
A <a href='https://drafts.csswg.org/css-page/#page-area'>page area</a> that can be used to display footnotes is described in the <a href='https://drafts.csswg.org/css-page/#page-context'>page context</a> using an <code>@footnote</code> rule. This rule defines a box that, if used, will contain all the footnote elements that appear on that page. <!--
We add the following to the <a href="https://drafts.csswg.org/css-page/#specializatons-of-ATKEYWORD">page rule grammar</a> in [[CSS3PAGE]]:
<pre class="lexical">
FOOTNOTE_SYM ::= "@footnote"
</pre>
-->
<p class="issue">How would one describe this in the grammar of CSS3-Page?</p>
<h4 id="footnote-area-position">Positioning of the footnote area</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">How do footnotes work in multi-column text? Prince uses <code>float: prince-column-footnote</code> to create a footnote at the bottom of a column rather than the bottom of a page.</p>
<p class="issue">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 id="footnote-area-size">Size of the footnote area</h4>
The 'max-height' 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).
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 id="footnote-counters">The Footnote Counter</h3>
The <dfn>footnote counter</dfn> is a predefined <a href="https://drafts.csswg.org/css-lists/#counter">counter</a> associated with the footnote element. Its value is the number or symbol used to identify the footnote. This value is used in both the footnote call and the footnote marker. It should be incremented for each footnote.
<h4 id="footnote-counter-values">Values of the footnote counter</h4>
The footnote counter, like other counters, may use any <a href="https://drafts.csswg.org/css-counter-styles-3/#counter-style">counter style</a>. Footnotes often use a sequence of symbols.
<div class="example">
<pre>
::footnote-call { content: counter(footnote, symbols('*', '†', '‡', '§')); }
::footnote-marker { content: counter(footnote, symbols('*', '†', '‡', '§')) '. '; }
</pre>
</div>
<h4 id="resetting-footnote-counter">Resetting the footnote counter</h4>
The footnote counter may be reset on each page.
<div class="example">
<pre>
@page {
counter-reset: footnote;
@footnote { … }
}
</pre>
</div>
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 id="footnote-call">
The <code>footnote-call</code> pseudo-element
</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 id="footnote-marker">
The <code>footnote-marker</code> pseudo-element
</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 [[CSS3LIST]]. 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 id="footnote-policy">
Rendering footnotes and <code>footnote policy</code>
</h3>
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 'footnote-policy' property allows authors some influence over the rendering of difficult pages.
<pre class="propdef">
Name: footnote-policy
Value: auto | line | block
Initial: auto
Applies to: elements
Inherited: no
Percentages: N/A
Computed value: specified value
Animation type: discrete
</pre>
<dl dfn-type="value" dfn-for="footnote-policy">
<dt><dfn>auto</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 id="footnote-policy-line">line</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="https://drafts.csswg.org/css-break/#widows-orphans">widow and orphan</a> settings when doing this, and so may need to insert the page break on an earlier line.</dd>
<dt><dfn>block</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">We need an algorithm for laying out footnotes</p>
<!--
<h4 id="pseudo-code-for-footnotes">
Pseudo-code for processing non-column footnotes
</h4>
let p = total height of any footnotes leftover from previous page
let t = margin-top of @footnote + padding-top of @footnote + border-top of @footnote
let g = total height of content area of page (goal in TeX lingo)
let m = max-height of @footnote (default is 75% of height of page content area)
let h(n) = height of nth footnote on page, as rendered in the footnote area
let f = total height needed for all footnotes on page
[1] at beginning of page, the following amount of space will be needed for footnotes:
f = if (p ne 0) then (p + t) else 0
[2] for n = 1 to (count of footnote elements on page)
f = f + h(n)
When starting a new page, the height of the footnote area is initially zero.
Load a page. If there are no leftover footnotes from previous pages to place, and no footnote elements on the current page, just render the current page. Otherwise,
<ol>
<li> create a footnote area, with the height of the content area set initially to zero, but all other properties as described by @footnote. The width of the footnote area is the width of the content area of the page. </li>
<li> Place any leftover footnotes in the footnote area, thus increasing its height. Continue until running out of leftover footnotes, reaching max height, or reaching height of page (size - top margin - bottom margin). If you still have parts of footnotes left after this process, mark them as leftover footnotes for the next page. </li>
<li> place the footnote area at the bottom of the page, reducing the content area of @page </li>
<li> if page is full of footnotes, go to next page. </li>
<li> If not, start drawing content on the page. if you reach a line with a footnote element, move element to bottom of footnote area. </li>
<li> Place as much of footnote as possible until reaching max height, or page height. </li>
<li> leave footnote-marker at location of footnote element. </li>
<li> increment footnote counter </li>
</ol>
-->
<!--
<h3>Sidenotes</h3>
<h4>Creating sidenotes</h4>
An element becomes a sidenote by applying float: sidenote to that element. This triggers several actions:
<ol>
<li>
The element is removed from the flow.
</li>
<li>
The sidenote element is positioned in the sidenote area, as described below.
</li>
</ol>
Unlike footnotes, calls and markers are not created by default for sidenotes.
<h4>The sidenote area</h4>
A page area that can be used to display sidenotes is described in the page context using an @sidenote rule. This rule defines a box that, if used, will contain the content that has been identified as a sidenote. The position or float properties of this box determines the placement of the sidenote.
-->
<h3 id="future">
Future directions
</h3>
The next level will include sidenotes, column footnotes, and multiple footnote areas.
<!--page selectors-->
<h2 id="the-first-page-pseudo-element">
Selecting Pages
</h2>
<!--should this be in css3-page?-->
A paginated document consists of a sequence of pages. [[CSS3PAGE]] defines <dfn>page selectors</dfn>, which allow the selection of the first page of the document, left and right pages, and blank pages. Here we extend the idea of page selectors to enable the selection of arbitrary document pages.
<h3 id="document-page-selectors">
Page Selectors
</h3>
The '':nth()'' page pseudo-class allows the selection of arbitrary document pages. This pseudo-class takes an argument of the form <a href="https://drafts.csswg.org/css-syntax/#anb">An + B</a> as defined in [[CSS3SYN]]. When applied to the default @page rule, '':nth()'' selects the document page whose index matches the argument.
<pre class="prod">
<dfn>:nth()</dfn> = :nth( <<an+b>> [of <<custom-ident>>]? )
</pre>
<p class="note">
'':nth()'' is not related to the page counter, which may reset and use various numbering schemes.</p>
When the '':nth()'' 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 id="document-sequence-selectors">
Page groups
</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 [[CSS3PAGE]] doesn’t define a way to select the first page of each chapter (as distinct from the first page of the entire document).
When the 'page' property is applied to an element that also has a forced break property applied, a ''page group'' is created. The <dfn>page group</dfn> is the collection of all pages created by an instance of that element. When a new instance of the element is rendered, a new ''page group'' is started.
A page may be part of several page groups, as a given ''page group'' may have ancestors or descendants that are part of another ''page group''.
<!-- A page group always starts on a new page.
NOT TRUE; NEED TO DESCRIBE
-->
<div class="example">
CSS:
<pre>
div {
page: A;
break-before: page;
}
child {
page: B;
break-before: page;
}
</pre>
<figure>
<img src="images/PageGroups.001.jpg" width="480" alt="">
<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">
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>
And CSS:
<pre>
div.chapter {
page: body;
break-before: page;
}
table.broadside {
page: broadside;
break-before: page;
}
</pre>
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 id="leaders">
Leaders (moved)
</h2>
Issue: Now described in [[CSS3-CONTENT]]
<h2 id="cross-references">
Cross-references (moved)
</h2>
Issue: Now described in [[CSS3-CONTENT]]
<h2 id="bookmarks">
Bookmarks (moved)
</h2>
Issue: Now described in [[CSS3-CONTENT]]
<h2 class="no-num" id="former-wd-sections">Appendix A: Where Are They Now?</h2>
Many sections which were in the <a href="https://www.w3.org/TR/2011/WD-css3-gcpm-20111129/">29 November 2011 Working Draft</a> have been moved to other specifications. Here are some notes on where things have moved.
<h3 id=page-marks-and-bleed-area>Page marks and bleed area</h3>
<p class="note">This section has been moved to <a href="https://drafts.csswg.org/css-page/#marks">CSS Paged Media Module Level 3</a>.</p>
<h3 id=cmyk-colors>CMYK colors</h3>
<p class="note">This section has been moved to <a href="https://drafts.csswg.org/css-color-5/#device-cmyk">CSS Color Module Level 5</a>.</p>
<h3 id=styling-blank-pages>Styling blank pages</h3>
<p class="note">This section has been moved to <a href="https://drafts.csswg.org/css-page/#blank-pseudo">CSS Paged Media Module Level 3</a></p>
<h3 id=paged-presentations>Paged presentations</h3>
<p class="note">This section has been moved to <a href="https://drafts.csswg.org/css-overflow-4/#overflow-concepts">CSS Overflow Module Level 4</a>.</p>
<h3 id=navigation-between-pages>Navigation between pages</h3>
<p class="note">This is discussed in <a href="http://books.spec.whatwg.org/#spatial-layout-of-pages;-@layout">WHATWG CSS Books</a>.</p>
<h3 id=page-floats>Page floats</h3>
<p class="note">This section has been moved to <a href="https://drafts.csswg.org/css-page-floats/">CSS Page Floats</a>.</p>
<h3 id=selecting-columns-and-pages>Selecting columns and pages</h3>
<p class="note">A brief mention of selecting columns is found in <a href="http://books.spec.whatwg.org/#selecting-columns">WHATWG CSS Books</a>.</p>
<h2 class="no-num" id="ua-stylesheet">Appendix B: Default UA Stylesheet</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 }
h4 { bookmark-level: 4 }
h5 { bookmark-level: 5 }
h6 { bookmark-level: 6 }
</pre>
</div>
<h2 class="no-num" id="changes">Appendix C: Changes</h2>
Changes since the <a href="http://www.w3.org/TR/2014/WD-css-gcpm-3-20140513/">13 May 2014 Working Draft</a>:
<ul>
<li>Clarify that bookmark is only created via 'bookmark-level' property. Remove <css>none</css> value from 'bookmark-label'.</li>
<li>Move the cross references, leaders, and bookmarks sections to the <a href="https://www.w3.org/TR/css-content-3/">CSS Generated Content Module</a>.</li>
<li>Incorrect break values were fixed. See <a href="https://github.com/w3c/csswg-drafts/issues/3524">Issue #3524</a>.</li>
<li>The spec has new editors.</li>
</ul>
Changes since the <a href="https://hg.csswg.org/drafts/raw-file/6a5c44d11c2b/css-gcpm/Overview.html">24 September 2013 Editor’s Draft</a>:
<ul>
<li>The spec has a new editor.</li>
<li>All text and examples rewritten.</li>
<li>Added ''attr(<identifier>)'' value to 'string-set' property. This is supported by both Prince and AntennaHouse.</li>
<li>Added 'footnote-policy' property to control rendering of footnotes in difficult situations.</li>
<li>Added 'footnote-display' property to allow inline footnotes.</li>
<li>Removed sidenotes section.</li>
<li>Removed section on selecting elements within pages and columns</li>
<li>Removed page-group property, and added optional argument to nth() page pseudo-class to allow selection within page groups.</li>
</ul>
Changes since the <a href="https://www.w3.org/TR/2011/WD-css3-gcpm-20111129/">29 November 2011 Working Draft</a>:
<ul>
<li>
Page Marks and Bleeds section moved to <a href="https://drafts.csswg.org/css-page/#marks">CSS Paged Media Module Level 3</a>
</li>
<li>
CMYK Colors section moved to <a href="https://drafts.csswg.org/css-color-5/#device-cmyk">CSS Colors Level 5</a>.
</li>
<li>
Styling Blank Pages section deleted
</li>
<li>
Paged Presentations section moved to <a href="https://drafts.csswg.org/css-overflow-3/#overflow-concepts">CSS Overflow Module Level 3</a>.
</li>
<li>
Navigation Between Pages moved to <a href="http://books.spec.whatwg.org/#spatial-layout-of-pages;-@layout">WHATWG CSS Books</a>
</li>
<li>
Page floats section moved to <a href="https://drafts.csswg.org/css-page-floats/">CSS Page Floats</a>
</li>
<li>
First-page pseudo-element section deleted
</li>
<li>
Selecting Columns and Pages section deleted
</li>
<li>
env() function removed from string-set property
</li>
<li>
alignment values of leaders removed
</li>
<li>
leader specified to occupy only a single line
</li>
<li>
content() value of target-text changed to content(text)
</li>
<li>
target-pull() value of content property removed
</li>
</ul>
<p>Differences with the <a href="http://books.ideas.whatwg.org/">WHATWG CSS Books</a> specification:</p>
<ul>
<li>Added ''attr(<identifier>)'' value to 'string-set' property. This is supported by both Prince and AntennaHouse.</li>
<li>
<a href="http://books.ideas.whatwg.org/">CSS Books</a> does not have the 'footnote-display' property.</li>