forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
1006 lines (829 loc) · 35.4 KB
/
Overview.html
File metadata and controls
1006 lines (829 loc) · 35.4 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 profile="http://www.w3.org/2006/03/hcard"><meta
content="text/html; charset=UTF-8" http-equiv=Content-Type>
<title>CSS Pagination Templates Module Level 3</title>
<link href="../default.css" rel=stylesheet type="text/css">
<style type="text/css">
/* Alternate stylesheet fonts are here because in some browsers (Opera 11.5) */
/* The fonts are not applied if only loaded from the alternate stylesheet */
/* License font the following two fonts: fonts/Droid-Serif-fontfacekit/Google Android License.txt */
@import url(fonts/Droid-Serif-fontfacekit/stylesheet.css);
@import url(fonts/Droid-Sans-Mono-fontfacekit/stylesheet.css);
body {
counter-reset: issue;
}
a.toggle {
position: fixed;
top: 0.5em;
right: 0.5em;
font-size: smaller;
color: gray;
opacity: 0.2;
}
a.toggle:hover {
opacity: 1;
color: #46A4E9;
}
.issue.resolved, .issue.stale, .issue.moved {
display: none;
}
#region-style-example p, #region-style-example pre {
clear: both;
}
#region_styling_illustration {
margin: 0px auto;
width: 70ex;
}
.big.note {
font-size: 1.2em;
line-height: 1.3em;
color: #2f2f2f;
}
#mobile-logo {
display: none;
}
.issue-marker:before {
content: "Issue ";
padding-left: 0.5em;
font-weight: bold;
color: #A00;
}
.issue-marker.wrapper:before {
content: none;
}
/* @media screen and (min-width: 68em){
.issue-marker {
position: absolute;
width: 20ex;
margin-left: -22ex;
text-align: right;
margin-bottom: 1em;
}
div.issue-marker .issue-marker {
position: static;
width: auto;
margin-left: 0;
text-align: right;
}
div.is
77F4
sue-marker {
position: absolute;
width: 20ex;
margin-left: -22ex;
}
}*/
@media screen and (max-width: 68em){
.issue-marker {
margin-bottom: 1em;
}
.issue-marker a:link {
padding-left: 0.5em;
}
}
#issue-manager form{
background: #eee;
padding:10px 1em;
}
/* hide all non-"updated" issues */
#issue-manager[data-view_state="updated"] #issue-list>div:not([data-issue_state="updated"]){
display:none;
}
/* hide all non-"new" issues */
#issue-manager[data-view_state="new"] #issue-list>div:not([data-issue_state="new"]){
display:none;
}
#issue-manager .issue-marker{
background: none;
position: relative;
margin:0;
width:auto;
text-align:left;
padding:0.5em 0;
}
#issue-manager .issue-marker a:link{
padding:0.5em;
}
#issue-list div[data-issue_state="new"]{
background:#C1FFC1;
}
#issue-list div[data-issue_state="resolved"]{
background:white;
color: #a0a0a0;
}
#issue-list div[data-issue_state="updated"]{
background:papayawhip;
}
#issue-list{
margin-top:20px;
}
#issue-list pre{
padding:1em;
margin:0;
}
#issue-list>div{
position:relative;
}
#issue-list a.issue-markup-trigger{
font-size: 0.8em;
padding: 0.2em 0.5em;
background: #eee;
text-decoration: none;
color: #444;
position: absolute;
right: 10px;
top: 10px;
z-index: 1;
}
#issue-list a.issue-markup-trigger:hover{
background: #ddd;
color: #000;
}
#issue-list .showMarkup pre{
display: block;
}
#issue-list .showMarkup .issue-marker,
#issue-list pre{
display: none;
}
.issue-marker {
background:#eee;
border:1px solid #ddd;
font-size: 1em;
max-height: 12em;
overflow: hidden;
}
.issue-marker.wrapper {
background: none;
border: none;
}
.issue-marker a:link {
color: #c00;
background: none;
font-weight: normal;
padding-right: 0.5em;
}
.issue-details {
padding:0.5em;
font-size: 0.8em;
line-height: 1.5;
}
93D4
.issue-details p{
padding:0;
margin:0;
}
.issue-details .status{
background:#333;
color:white;
float:left;
padding:0.15em 0.8em;
font-size:0.8em;
margin-right:0.8em;
text-transform:uppercase;
}
.separate-pre {
background-color: rgba(0, 0, 0, 0.08);
}
</style>
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<link href="../alternate-spec-style.css" id=st rel=stylesheet
title="alternate spec style" type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Pagination Templates Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 17 March 2012</h2>
<dl>
<dt>This version:
<!--<dd><a href="http://www.w3.org/TR/2012/ED-css3-page-template-20120317/">http://www.w3.org/TR/2012/ED-css3-page-template-20120317/</a>-->
<dd><a
href="//dev.w3.org/csswg/css3-page-template/">http://dev.w3.org/csswg/css3-page-template/</a>
<dt>Latest version:
<!--<dd><a href="http://www.w3.org/TR/css3-page-template/">http://www.w3.org/TR/css3-page-template/</a>-->
<dd><a
href="//www.w3.org/TR/css3-page-template/">http://www.w3.org/TR/css3-page-template/</a>
<dt>Editor's draft:
<dd><a
href="//dev.w3.org/csswg/css3-page-template/">http://dev.w3.org/csswg/css3-page-template/</a>
<!--
<dt>Previous version:
<dd><a href="http://www.w3.org/PreviousVersionURI">
http://www.w3.org/PreviousVersionURI</a>
-->
<dt>Editors:
<dd class=vcard><span class=fn>Alan Stearns</span>, <span class=org>Adobe
Systems, Inc.</span>, <span class=email>stearns@adobe.com</span>
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2012 <a
href="http://www.w3.org/"><acronym
title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym
title="Massachusetts Institute of Technology">MIT</acronym></a>, <a
href="http://www.ercim.eu/"><acronym
title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>The Pagination Templates module describes templates that can be defined
in CSS to display content in a paginated view. These templates define a
page containing one or more boxes with content assignments. As content
overflows additional pages are generated using template selection rules
until all of the content is displayed.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-page-template%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
discussion of this specification. When sending e-mail, please put the text
“css3-page-template” in the subject, preferably like this:
“[<!---->css3-page-template<!---->] <em>…summary of
comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a
href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<p>The following features are at risk: none
<h2 class="no-num no-toc" id=contents>Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#intro"><span class=secno>1. </span>Introduction</a>
<ul class=toc>
<li><a href="#placement"><span class=secno>1.1. </span>Module
Interactions</a>
</ul>
<li><a href="#templates-and-slots"><span class=secno>2. </span>Pagination
Templates and Slots</a>
<li><a href="#conditional-templates"><span class=secno>3. </span>Template
Selection</a>
<ul class=toc>
<li><a href="#ordered-templates"><span class=secno>3.1. </span>Selecting
Templates by Page Order</a>
<li><a href="#selection-from-required-flows"><span class=secno>3.2.
</span>Selecting Templates from Required Flows</a>
<li><a href="#selection-from-available-content"><span class=secno>3.3.
</span>Selecting Templates from Available Content</a>
</ul>
<li><a href="#cssom"><span class=secno>4. </span>CSS Object Model</a>
<li><a href="#conformance"><span class=secno>5. </span>Conformance</a>
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
<li class=no-num><a href="#references">References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#other-references">Other references</a>
</ul>
<li class=no-num><a href="#index">Index</a>
</ul>
<!--end-toc-->
<h2 id=intro><span class=secno>1. </span>Introduction</h2>
<p><em>This section is not normative.</em>
<p>This module describes how to define pagination templates in CSS. In CSS
2.1 content displayed on-screen is assumed to be a single continuous
canvas. Pagination templates provide a mechanism for a ‘<code
class=property>paginated</code>’ experience that applies to
on-screen presentation as well as printed media. Pagination templates
describe the layout of pages in which content is displayed as the user
moves from page to page on screen or prints the document content. When
content is laid out using pagination templates, pages are generated as
needed to accommodate all the content.
<div class=issue-marker>
<div class=issue-details>The draft as it stands requires pagination to
present the repeated template layouts. Other methods of repeating
template layouts to accommodate content might be specified, but the draft
would need to be reviewed to remove all reliances on paged displays.</div>
</div>
<p>Pagination templates consist of anonymous boxes called slots created by
CSS to contain content. Layouts that use pagination templates mainly
determine the size of these slots from the template definition instead of
the intrinsic size of their content. When content does not fit into a
template slot, additional pages are created with more slots to contain the
overflow content.
<p>Multiple pagination templates can be defined for a given document. A
paginated element can use a single template or select from a set of
templates each time a new page needs to be generated. Which template is
used for a given page can be defined by a selector or by choosing a
template based on available content. Elements can further constrain the
applicable template set by listing a subset of templates that apply.
<div class=issue-marker>
<div class=issue-details>The terms ‘<code
class=property>template</code>’ and ‘<code
class=property>page</code>’ are overloaded in CSS, but they are the
words that most clearly describe the concept. Some alternates for the
main @ rule: template, page-template, view-template, page-master,
master-template, master. Other suggestions are welcome, but only if they
are more helpful than onelook.com (which suggested "Captain Submarine").</div>
</div>
<h3 id=placement><span class=secno>1.1. </span>Module Interactions</h3>
<p>This module uses named flows and region chains defined in <a
href="#CSS3-REGIONS"
rel=biblioentry>[CSS3-REGIONS]<!--{{CSS3-REGIONS}}--></a>.
<p>This module uses the overflow-style property from <a href="#CSS3GCPM"
rel=biblioentry>[CSS3GCPM]<!--{{CSS3GCPM}}--></a>.
<p>Some examples use positioning from <a href="#CSS3GRID"
rel=biblioentry>[CSS3GRID]<!--{{CSS3GRID}}--></a>.
<h2 id=templates-and-slots><span class=secno>2. </span>Pagination Templates
and Slots</h2>
<p>An @template rule defines a pagination template. Pagination templates
contain one or more slots to display content. An element can use
pagination templates if its ‘<code
class=property>overflow-style</code>’ property is set to any of the
paged-* values defined in css3-gcpm. If a document defines no pagination
templates, then there is an implicit pagination template with a single
slot containing the paginated element's contents.
<div class=issue-marker>
<div class=issue-details>Do pagination templates get their size (and other
characteristics) from the element with the overflow-style property, or
does this have be set in the @template rule? Can templates use a default
100%/100% size based on the element's box?</div>
</div>
<p>A slot is an anonymous box in a pagination template where content can be
placed. In an @template rule @slot rules create slots. The order of @slot
rules determines the order of the boxes in the pagination template. Each
@slot rule can take an optional name.
<p>Slots default to displaying the content of the paginated element. Slots
can instead contain generated content assigned with the content property.
Slots can also be assigned content from named flows.
<div class=example>
<p>An @template rule that creates header and footer slots around the
paginated element's content
<pre>
@template {
@slot header { content: "header string"; }
@slot { }
@slot footer { content: "footer string"; }
}
</pre>
</div>
<p>If any slot in a particular page has overflow content, a new page is
created with a new set of slots to receive the overflow content. Slots
with the same named flow assignment form a region chain (within a
pagination template and/or across pages created from pagination
templates). When a new page is created a slot that has been assigned
element content or content from a named flow may not have any content left
to render. In this case the slot for the exhausted content source is not
instantiated.
<div class=issue-marker>
<div class=issue-details>If there is more than one slot with no
‘<code class=property>content</code>’ or ‘<code
class=property>flow-from</code>’ assignment, does the element's
content use all of these slots like a region chain, or is only the last
unassigned slot used for content?</div>
</div>
<div class=example>
<p>The simplest example takes all of the content in the document and flows
it into a single pagination template with a single slot. This template
will display a viewport's worth of content at a time, and will create a
new slot on a new page each time content overflows.
<p>The three examples below are equivalent, but merely illustrate how
content from the element can be assigned to pagination template slots.
Actual use of templates would either define more slots or assign content
differently than the default.
<pre class=separate-pre>
body { overflow-style: paged-x; }</pre>
<pre class=separate-pre>
body { overflow-style: paged-x; }
@template {
@slot { }
}</pre>
<pre class=separate-pre>
body { overflow-style: paged-x; }
body > * { flow-into: body-flow; }
@template {
@slot { flow-from: body-flow; }
}</pre>
</div>
<div class=issue-marker>
<div class=issue-details>@slot rules are a first pass at defining
CSS-created boxes. Other means of creating and addressing pseudo-element
slots have been discussed on www-style. Another possibility is using HTML
like WebComponents does to define the boxes. However the boxes are
created there needs to be a way of assigning content to boxes and
accessing the template structure through scripting. If pseudo-elements
are used, then OM for pseudo-elements must be defined. If HTML templates
are used a declarative method of mapping content to elements must be
defined.</div>
</div>
<p>Pagination templates can use declarations to determine the layout method
for slots. @slot rules can use sizing and positioning declarations.
<div class=issue-marker>
<div class=issue-details>Is there a need to create more structure, nesting
slots within slots? If so, then slots can also have layout method
declarations?</div>
</div>
<div class=example>
<p>A pagination template could contain two side-by-side slots that
paginate two separate articles. Side-by-side translations are often laid
out this way. This example fills the left side of the paged view with
content from an English article and the right side with content from a
French article. New pages and slots are created until the content from
both articles is exhausted. If one article is longer than the other then
in this simple example template the longer article will continue taking
up just its half of the page.
<p> <img alt="side-by-side flows on a page"
src="images/side-by-side-1.png" width=120> <span
style="font-size:50px">…</span> <img
alt="side-by-side flows with the left ending"
src="images/side-by-side-2.png" width=120> <img alt="only the right flow"
src="images/only-one-side-3.png" width=120> <span
style="font-size:50px">…</span>
<pre>
body { overflow-style: paged-x; }
.english { flow-into: english-flow; }
.french { flow-into: french-flow; }
@template {
@slot left {
flow-from: english-flow;
width: 40%;
height: 90%;
padding: 5%;
float: left;
}
@slot right {
flow-from: french-flow;
width: 40%;
height: 90%;
padding: 5%
float: right;
}
}
<body>
<article class='english'>...content...</article>
<article class='french'>...contenu...</article>
</body>
</pre>
</div>
<div class=example>
<p>The example above could position the slots using grid layout rather
than floats. In this simple example the longer article will take up the
entire page once the shorter article is exhausted.
<p> <img alt="side-by-side flows on a page"
src="images/side-by-side-1.png" width=120> <span
style="font-size:50px">…</span> <img
alt="side-by-side flows with the left ending"
src="images/side-by-side-2.png" width=120> <img
alt="the right flow takes up the whole page" src="images/whole-page.png"
width=120> <span style="font-size:50px">…</span>
<pre>
body { overflow-style: paged-x; }
.english { flow-into: english-flow; }
.french { flow-into: french-flow; }
@template {
display: grid;
grid-columns: 1fr 1fr;
@slot left {
flow-from: english-flow;
padding: 5%;
grid-column: 1;
}
@slot right {
flow-from: french-flow;
padding: 5%
grid-column: 2;
}
}
<body>
<article class='english'>...content...</article>
<article class='french'>...contenu...</article>
</body>
</pre>
</div>
<h2 id=conditional-templates><span class=secno>3. </span>Template Selection</h2>
<p>Multiple templates can be defined for a single document. An element that
uses pagination templates either selects a template from the entire
document set or a subset defined by the ‘<code
class=property>template-set</code>’ property. Each page view created
uses a single template. This template can be chosen from the applicable
set using a selector, by matching content to display using the
‘<code class=property>required-flow</code>’ or ‘<code
class=property>available-content</code>’ declarations, or just
taking the first template found.
<div class=example>
<p>In this example the divs are paginated using the first template found
from the set of templates that apply to the div. The first div uses
template one, the second div uses template two, and the third div uses
template three.
<pre>
div { overflow-style: paged-x; }
.either-two-or-three { template-set: two three; }
.only-three { template-set: three; }
@template one { ... }
@template two { ... }
@template three { ... }
<div class='any-template'> ... </div>
<div class='either-two-or-three'> ... </div>
<div class='only-three'> ... </div>
</pre>
</div>
<div class="issue-marker wrapper">
<div class=issue-marker>
<div class=issue-details>Instead of specifying a template-set, should
there be a way of scoping @template rules to an element? The reason to
put them on the document is to re-use pagination templates with multiple
elements.</div>
</div>
<div class=issue-marker>
<div class=issue-details>One way of promoting re-use of pagination
templates would be to parameterize the named flow idents. Instead of
using named flow idents directly, @slot rules could use a parameter and
a paginated element using the template would pass in the particular
named flow ident meant for that parameter.</div>
</div>
</div>
<h3 id=ordered-templates><span class=secno>3.1. </span>Selecting Templates
by Page Order</h3>
<p>Selectors such as :first can be used on a pagination template to define
a separate template for pages that match the selector.
<div class=issue-marker>
<div class=issue-details>Should :left and :right be allowed with a way of
displaying more than one page at a time in a viewport? Should :nth(x)
selectors be allowed?</div>
</div>
<div class=issue-marker>
<div class=issue-details>Describe how @template rules with selectors
cascade.</div>
</div>
<div class=example>
<p>Any of the side-by-side two-article examples from the previous section
could have an @template :first {} rule that defined a fancy layout for
the first page.
<pre>
@template :first {
@slot left {
//fancy styling
flow-from: article1;
}
@slot right {
//fancy styling
flow-from: article2;
}
}
</pre>
</div>
<div class="issue-marker wrapper">
<div class=issue-marker>
<div class=issue-details>define "fancy."</div>
</div>
<div class=issue-marker>
<div class=issue-details>Depending on how template selection is defined,
there will likely be scenarios where degenerate template sets can either
fail to display all of the content or result in an infinite loop of page
generation. This first draft falls into the latter category (make a
:first template with a slot that overflows, but fail to include an
assignment for that slot's content in all other templates), so this will
need to be addressed with more selection rules.</div>
</div>
</div>
<h3 id=selection-from-required-flows><span class=secno>3.2.
</span>Selecting Templates from Required Flows</h3>
<p>The ‘<code class=property>required-flow</code>’ property can
be used in a pagination template to list named flows that must still have
content in order for the template to be used. If more than one template
has a ‘<code class=property>required-flow</code>’ value that
matches the remaining flow content, the first template that matches will
be used.
<div class=example>
<p>"Continued on" layout.
<p>These pagination templates will display an inital page with the
beginning of both the ‘<code
class=property>lead-story</code>’ flow and a ‘<code
class=property>related-article</code>’ flow. If the lead story has
more content than will fit on that first page, the next page(s) will show
only content from that lead story. When the content from the lead story
is exhausted, then pages will follow with content from the related
article.
<p> <img alt="side-by-side flows on a page"
src="images/side-by-side-1.png" width=120> <img
alt="columns continuing just the first flow"
src="images/first-article-columns.png" width=120> <span
style="font-size:50px">…</span> <img
alt="columns ending the first flow" src="images/first-article-end.png"
width=120> <img alt="columns continuing the second flow"
src="images/second-article-columns.png" width=120> <span
style="font-size:50px">…</span>
<pre>
body { overflow-style: paged-x; }
.lead-story { flow-into: first-flow; }
.related-article { flow-into: second-flow; }
@template :first {
@slot left {
flow-from: first-flow;
width: 40%;
height: 90%;
padding: 5%;
float: left;
}
@slot right {
flow-from: second-flow;
width: 40%;
height: 90%;
padding: 5%
float: left;
}
}
@template {
required-flow: first-flow;
@slot first {
flow-from: first-flow;
column-width: 20em;
}
}
@template {
required-flow: second-flow;
@slot second {
flow-from: second-flow;
column-width: 20em;
}
}
<body>
<article class='lead-story'>...content...</article>
<article class='related-article'>...content...</article>
</body>
</pre>
</div>
<h3 id=selection-from-available-content><span class=secno>3.3.
</span>Selecting Templates from Available Content</h3>
<p>Pagination templates can be selected based on the order of content in
the original markup. Content may be split out into one or more named
flows, but the original order can be discovered in the markup.
<p>Pagination templates have a ‘<code
class=property>primary</code>’ content flow. The primary flow for a
pagination template is usually the content of the paginated element. If no
slot in the template displays the element contents, then the primary flow
of the pagination template is the first named flow in its required-flow
declaration.
<p>When selecting the pagination template for the next page, the primary
flow in the original markup can be scanned to determine whether any
out-of-flow content in named flows was originally related to the next page
of primary flow. If this is the case, then those named flows have
‘<code class=property>available</code>’ content for the
purpose of selecting an appropriate template that can display this
content.
<p>Pagination templates can have an ‘<code
class=property>available-content</code>’ declaration listing the
named flows that must have available content for the template to be
selected. Templates with more ‘<code
class=property>available-content</code>’ flow matches take
precedence over fewer or no ‘<code
class=property>available-content</code>’ flow matches. If a template
with an ‘<code class=property>available-content</code>’
declaration is chosen, only the available content in those flows is
displayed in the slots associated with those flows.
<div class=example>
<p>Clarification example
<p>Consider an article element that contains images scattered throughout.
Assign the images to a flow named ‘<code
class=property>images</code>’ and the rest of the article to a flow
named ‘<code class=property>text</code>’. Then define two
pagination templates - one that has slots only for the ‘<code
class=property>text</code>’ flow, and another that has slots for
both the ‘<code class=property>text</code>’ and ‘<code
class=property>images</code>’ flows. Both templates require the
‘<code class=property>text</code>’ flow, but the second
template also requires the ‘<code
class=property>images</code>’ flow and has an ‘<code
class=property>available-content</code>’ declaration listing the
‘<code class=property>images</code>’ flow. Each time a page
is laid out, the original article element is scanned to see whether an
image element is in the next page's worth of content (determined by some
markup-scanning heuristic – not layout). If so, then that content from
the ‘<code class=property>images</code>’ flow is available
for the purpose of selecting a template.
</div>
<div class=issue-marker>
<div class=issue-details>Expand this.</div>
</div>
<div class=example>
<p>Motivational example
<p>Assume you have an article that contains both pull quotes and images.
If only images <em>or</em> pull quotes would occur on a page, position
those elements in the center right of the template. But if both images
<em>and</em> pull quotes would appear, position the images in the top
left and the pull quotes in the bottom right.
<div class=issue-marker>
<div class=issue-details>code this example</div>
</div>
</div>
<h2 id=cssom><span class=secno>4. </span>CSS Object Model</h2>
<div class=issue-marker>
<div class=issue-details>There should be extensive OM defined to access
pages and slots. What page is being displayed should be available. Pages
and slots should accept event handlers. Anchors should navigate to the
appropriate page (as should search). What content fits in each slot and
page should be determinable. Lots to fill out here.</div>
</div>
<h2 id=conformance><span class=secno>5. </span>Conformance</h2>
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
<p>The editor is grateful to the CSS working group for their feedback and
help with the genesis of this specification.
<p>In addition, the editor would like to thank the following individuals
for their contributions, either during the conception of CSS Pagination
Templates or during its development and specification review process:
<ul>
<li>Rossen Atanassov
<li>Tab Atkins
<li>Alexandru Chiculita
<li>Sylvain Galineau
<li>Vincent Hardy
<li>David Hyatt
<li>Brad Kemper
<li>Håkon Wium Lie
<li>Alex Mogilevsky
<li>Christoph Päper
<li>Peter Sorotokin
<li>Stephen Zilles
</ul>
<h2 class=no-num id=references>References</h2>
<h3 class=no-num id=normative-references>Normative references</h3>
<!--begin-normative-->
<!-- Sorted by label -->
<dl class=bibliography>
<dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
<!---->
</dl>
<!--end-normative-->
<h3 class=no-num id=other-references>Other references</h3>
<!--begin-informative-->
<!-- Sorted by label -->
<dl class=bibliography>
<dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
<!---->
<dt id=CSS3-REGIONS>[CSS3-REGIONS]
<dd>Vincent Hardy; Alex Mogilevsky. <a
href="http://www.w3.org/TR/2011/WD-css3-regions-20111129/"><cite>CSS
Regions Module Level 3.</cite></a> 29 November 2011. W3C Working Draft.
(Work in progress.) URL: <a
href="http://www.w3.org/TR/2011/WD-css3-regions-20111129/">http://www.w3.org/TR/2011/WD-css3-regions-20111129/</a>
</dd>
<!---->
<dt id=CSS3GCPM>[CSS3GCPM]
<dd>Håkon Wium Lie. <a
href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608"><cite>CSS
Generated Content for Paged Media Module.</cite></a> 8 June 2010. W3C
Working Draft. (Work in progress.) URL: <a
href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608">http://www.w3.org/TR/2010/WD-css3-gcpm-20100608</a>
</dd>
<!---->
<dt id=CSS3GRID>[CSS3GRID]
<dd>Alex Mogilevsky; Markus Mielke. <a
href="http://www.w3.org/TR/2007/WD-css3-grid-20070905"><cite>CSS Grid
Positioning Module Level 3.</cite></a> 5 September 2007. W3C Working
Draft. (Work in progress.) URL: <a
href="http://www.w3.org/TR/2007/WD-css3-grid-20070905">http://www.w3.org/TR/2007/WD-css3-grid-20070905</a>
</dd>
<!---->
</dl>
<!--end-informative-->
<h2 class=no-num id=index>Index</h2>
<!--begin-index-->
<ul class=indexlist></ul>
<!--end-index-->
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-declaration:"~/SGML/HTML4.decl"
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
sgml-nofill-elements:("pre" "style" "br")
sgml-live-element-indicator:t
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:t
sgml-general-insert-case:lower
sgml-always-quote-attributes:t
sgml-indent-step:nil
sgml-indent-data:t