-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.src.html
More file actions
executable file
·1990 lines (1511 loc) · 71.7 KB
/
Overview.src.html
File metadata and controls
executable file
·1990 lines (1511 loc) · 71.7 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 PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr" lang="en">
<head profile="http://www.w3.org/2006/03/hcard">
<meta http-equiv="X-UA-Compatible" co
F2A9
ntent="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CSS Regions Module</title>
<link href="../default.css" rel="stylesheet" type="text/css">
<link id="st" href="alternate-spec-style.css" rel="stylesheet" type=
"text/css" title="additional spec styles">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel="stylesheet"
type="text/css">
</head>
<body>
<div class="head" id="div-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--></p>
<h1 id="css-regions-module">CSS Regions Module</h1>
<h2 class="no-num no-toc" id="longstatus-date">[LONGSTATUS]
[DATE]</h2>
<dl>
<dt>This version:</dt>
<dd><a href=
"[VERSION]">http://www.w3.org/csswg/css3-regions
<!--http://www.w3.org/TR/[YEAR]/WD-[SHORTNAME]-[CDATE]/--></a></dd>
<dt>Latest version:</dt>
<dd><a href=
"http://www.w3.org/TR/css3-regions">http://www.w3.org/TR/css3-regions</a></dd>
<dt>Previous version:</dt>
<dd>none</dd>
<dt>Editors:</dt>
<dd class="vcard"><span class="fn">Vincent Hardy</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">vhardy@adobe.com</span></dd>
<dt>Authors and Former Editors:</dt>
<dd class="vcard"><span class="fn">Stephen Zilles</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">szilles@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Alexandru Chiculita</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">achicu@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Andrei Bucur</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">abucur@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Mihnea Ovidenie</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">mihnea@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Peter Sorotokin</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">psorotok@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Virgil Palanciuc</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">virgilp@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Arno Gourdol</span>,
<span class="org">Adobe Systems, Inc.</span>, <span class=
"email">agourdol@adobe.com</span></dd>
</dl><!--begin-copyright--><!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>The CSS Regions module allows content to flow across multiple areas
called regions. The regions do not necessarily follow the document order.
The CSS Regions module provides an advanced content flow mechanism, which
can be combined with positioning schemes as defined by other CSS modules
such as the Multi-Column Module [[!CSS3COL]] or the Grid Layout Module
[[CSS3-GRID-LAYOUT]] to position the regions where content flows.</p>
<h2 class="no-num no-toc" id="status-of-this-document">Status of this
document</h2><!--begin-status-->
<p><em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
index at http://www.w3.org/TR/.</a></em></p>
<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>
<p>The archived public mailing list www-style@w3.org is preferred for
discussion of this specification. When sending e-mail, please put the text
"css3-regions" in the subject, preferably like this: "[css3-regions]
…summary of comment…"</p>
<p>This draft is related to the drafts about Multi-column Layout <a href=
'#CSSMULTICOL'>[CSSMULTICOL]</a>, Grid Layout <a href=
'#CSS3GRID'>[CSS3GRID]</a>, Flexible Box Layout <a href=
'#CSS3FLEXBOX'>[CSS3FLEXBOX]</a>, and Template Layout <a href=
'#CSSTEMPLATELAYOUT'>[CSSTEMPLATELAYOUT]</a>.</p><!--end-status-->
<h2 class="no-num no-toc" id="table-of-contents">Table of contents</h2>
<!--begin-toc--><!--end-toc-->
<h2 id="introduction">Introduction</h2>
<p>Capturing the complex layouts of a typical magazine, newspaper, or
textbook requires capabilities beyond those available in existing CSS
modules. This is the purpose of the CSS Regions module.</p>
<p> </p>
<p>The CSS Regions module can be seen as an extension of the concept of
multi-column elements. With CSS Multi-column layout [[!CSS3COL]], columns
share the same dimensions and define column boxes organized in rows.
Content flows from one column to the next.</p>
<p> </p>
<p>The multi-column model is an example of flowing content from one area to
another, where the areas are the multi-column element's column boxes and
the flow is made of the multi-column element's children.</p>
<p> </p>
<p>However, for more complex layouts, content needs to flow from one area
of the page to the next without limitation of the areas' sizes and
positions. These arbitrary areas are the target of specific content flows.
In this document these areas are called regions, and the content flows are
called named flows. Regions are based on the rectangular geometry of the
CSS box model. Elements in a named flow are taken out of the normal visual
formatting and rendered in a chain of regions.</p>
<h3 id="named-flows-and-regions">Named flows and regions</h3>
<p>Consider the layout illustrated in figure 1.</p>
<div class="figure">
<img src="images/regions-intro.svg" width="400" alt=
"multiple chained regions which should receive content from a flow">
<p class="caption">Layout requiring sophisticated content flow</p>
</div>
<p>The designer's intent is to position an image in region 'A' and to flow
an article's text from region '1', to region '2', '3' and '4'.</p>
<p>The following code snippet shows the content to flow between the regions
1, 2, 3 and 4.</p>
<pre>
<div <em>id="article"</em>>
<h1>Introduction</h1>
<p>This is an example ...</p>
<h1>More Details</h1>
<p>This illustrates ...</p>
<p>Then, the example ...</p>
<p>Finally, this ...</p>
</div>
</pre>
<p>CSS layout facilities can position and size regions as needed. However,
there is no existing mechanism to associate the content with the regions so
that content flows as intended. Figure 2 shows an example of the intended
visual rendering of the content.</p>
<div class="figure">
<img src="images/regions-intro-rendering.png" width="450" alt=
"Sample rendering showing a single thread of text flowing through a chain of regions">
<p class="caption">Sample rendering for desired layout</p>
</div>
<p>Since the CSS Regions module is independent of the layout of regions and
the mechanism used to create them, the following assumes there is a CSS
selector for the regions and, for the purpose of the example, the selectors
for regions 1, 2, 3 and 4 show as ''<region1_sel>'',
''<region2_sel>'', ''<region3_sel>'' and
''<region4_sel>'' respectively. Such a selector could be an id
selector (e.g., ''#region_1'') or a grid cell selector (e.g.,
''#myGrid::grid-cell([cell-name])'') if using the CSS Grid Layout module,
for example.</p>
<div class="example">
<pre>
<style>
#article {
<strong>flow: article_flow;</strong>
}
<region1_sel>, <region2_sel>,
<region3_sel>, <region4_sel> {
<strong>content: from-flow(article_flow);</strong>
}
</style>
</pre>
</div>
<p>The above stylesheet directs the ''#article'' element to a named flow
called 'article_flow' by setting the 'flow' property. Then, content is
"poured" from that named flow into the desired regions by setting the
regions' 'content' property to ''from-flow(article_flow)''.</p>
<h3 id="region-styling">Regions Styling</h3>
<p>Region styling allows content to be styled depending on the region it
flows into. It is a form of context-based styling, similar to Media Queries [[MEDIAQ]] which enable or disable
selectors depending on the rendering context. With region styling,
additional selectors may apply depending on the region into which content
flows.</p>
<p>In our example, the designer wants to make text flowing into region 1
larger, bold and dark blue. In addition, <code class=
"html"><h1&
1917
;gt;</code> headers should be run-ins and crimson.</p>
<p>This design can be expressed with region styling as shown below.</p>
<div class="example">
<pre>
<style>
/*
* Default article styling.
*/
#article {
color:#777;
text-align: justify;
}
#article h1 {
border-left: 1px solid #777;
padding-left: 2ex;
}
/*
* Additional styling to apply to content when it falls into
* region_1
*/
<strong>@region <region1_sel> {</strong>
#article::region-lines {
font-weight: bold;
color: #0C3D5F;
font-size: larger;
}
#article h1 {
color: crimson;
display: run-in;
border: none;
padding: 0px;
}
<strong>}</strong>
</style>
</pre>
</div>
<p>The '@region' rule for region 1 limits its selectors to content flowing
into region 1. The following figure shows how the rendering changes if we
do not increase the font size nor make it bold for content flowing into
region 1. As more content can be fitted, more content is subject to the
contextual selectors, resulting in more dark blue text into region 1.</p>
<p>The ''::region-lines'' pseudo-element is described later in this
specification.</p>
<div class="figure">
<img src="images/region-styling.png" width="450" alt=
"Illustrate how changing region styling affects the flow of content.">
<p class="caption">Different rendering with a different region
styling</p>
</div>
<h2 id="css-regions-model">CSS Regions Model</h2>
<h3 id="named-flows">Named flows</h3>
<p>In the <a href="http://www.w3.org/TR/CSS21/visuren.html">CSS formatting
model</a>, elements can be in the <em>normal flow</em> or out of the
<em>(normal) flow</em>. Boxes generated by elements in the normal flow are
subject to their container box's normal layout scheme. Boxes generated by
elements out of the normal flow are subject to a different layout scheme.
For example, absolutely positioned elements are subject to absolute
positioning into their <a href=
"http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">containing
block</a>. This can be described by saying that the absolutely positioned
elements are part of a special flow (called <span title=
"positioned-flow">positioned flow</span>) which is subject to a special
layout by its container box (i.e., its container box positions it into the
containing block's box).</p>
<p> </p>
<p>In both cases, there is a notion of flow containing a sequence of
elements and there is a notion of <a href=
"http://www.w3.org/Style/Group/css2-src/visuren.html#block-boxes">(block)
container box</a> into which the elements flow.</p>
<p> </p>
<p>The CSS Regions module generalizes the concept of flow by adding the
concept of a <em>named flow</em>. This module lets authors explicitly place
elements into a <em>named flow</em>.</p>
<p> </p>
<p>With this model, all elements are moved to a flow as part of the visual
formatting. That flow may be the normal flow, a named flow or a positioned
flow, for example. A flow gets formatted visually when associated with one
or several elements' container box(es). When an flow is associated with
container boxes, the boxes generated by the flow's elements are laid out
according to the container box's layout scheme and the flow is subject to
the <a href='#flow-breaking-rules'>'flow breaking rules'</a> described
below.</p>
<p>A container's layout scheme is the strategy used by a container to
position the boxes generated by its children and itself. Examples are the
normal layout (block and inline formatting) ([[!CSS21]]), table layout
([[!CSS21]]), the multi-column layout ([[!CSS3COL]]) or the grid layout
([[CSS3-GRID-LAYOUT]]).</p>
<h3 id="regions">Regions</h3>
<p class="index" title="region" id="region">A region is an element that
generates a <a href=
"http://www.w3.org/TR/CSS21/visuren.html#block-boxes">block container
box</a> and has an associated <em>named flow</em> (see the 'content'
property).</p>
<p>A <span title="region">region</span>'s intrinsic width is zero.</p>
<h3 id="flow-breaking-rules">Flow breaking rules</h3>
<p>Breaking a named flow across multiple regions is similar to breaking a
document's content across multiple pages. One important difference is that
page boxes are generated based on the available content whereas regions are
a predefined set of recipients for the named flow content.</p>
<h4 id="breaking-a-named-flow-and-determining-the-current-flow-region">
Breaking a named flow and determining the current flow region</h4>
<p>The 'content-order' property defines how <span title=
"region">regions</span> are organized in to a <span title=
"region-chain">region chain</span>.</p>
<p>Each region in turn consumes content from its associated <span title=
"named-flow">named flow</span>. This means that the named flow content is
positioned in the <dfn title="current-region">current region</dfn> until a
region break occurs, at which point the <span title=
"current-region">current region</span> becomes the next one in the
<span title="region-chain">region chain</span>. If there is no more
<span>region</span> in the region chain and there is still content in the
flow, the positioning of the remaining content is controlled by the
'region-overflow' property on the last <span>region</span> in the
chain.</p>
<p>The following sections define where region breaks may happen when
positioning a named flow across <span title="region">regions</span> in a
<span title="region-chain">region chain</span>.</p>
<div class="issue">
<p>The sections on "Allowed region breaks", "Forced region breaks" and
""Best" region breaks" are adapted from the [[!CSS21]] specification.
There is an updated version of these paragraphs in [[CSS3PAGE]] as
well.</p>
<p>In addition, the CSS Multi-column Layout Module [[!CSS3COL]] defines
unified breaking properties (which this specification extends).</p>
<p>It seems that we should:</p>
<ol>
<li>Define a common set of rules for breaking content that accounts
for pages, columns and regions.</li>
<li>Define the properties for breaking content in a single
specification as well.</li>
<li>Specify how column, page and region breaks interact.</li>
</ol>
</div>
<h4 id="allowed-region-breaks">Allowed region breaks</h4>
<p>In a named flow, region breaks can occur at the following places:</p>
<ol>
<li>In the vertical margin between block-level boxes. When an unforced
region break occurs here, the <a href="/TR/CSS2/cascade.html#used-value">used
values</a> of the relevant <a href="/TR/CSS2/box.html#propdef-margin-top" class=
"noxref"><span class="propinst-margin-top">'margin-top'</span></a> and
<a href="/TR/CSS2/box.html#propdef-margin-bottom" class="noxref"><span class=
"propinst-margin-bottom">'margin-bottom'</span></a> properties are set
to '0'. When a forced region break occurs here, the used value of the
relevant <a href="/TR/CSS2/box.html#propdef-margin-bottom" class=
"noxref"><span class=
"propinst-margin-bottom">'margin-bottom'</span></a> property is set to
'0'; the relevant <a href="/TR/CSS2/box.html#propdef-margin-top" class=
"noxref"><span class="propinst-margin-top">'margin-top'</span></a> used
value may either be set to '0' or retained.</li>
<li>Between <a href="/TR/CSS2/visuren.html#line-box">line boxes</a> inside a
<a href="/TR/CSS2/visuren.html#block-boxes">block container</a> box.</li>
<li>Between the content edge of a block container box and the outer
edges of its child content (margin edges of block-level children or
line box edges for inline-level children) if there is a (non-zero) gap
between them.</li>
</ol>
<p>These breaks are subject to the following rules:</p>
<ul>
<li><strong>Rule A:</strong> Breaking at (1) is allowed only if the
'break-after' 'break-before' properties of all the elements generating
boxes that meet at this margin allow it, which is when at least one of
them has the value 'always', 'left', or 'right', or when all of them
are 'auto'.</li>
<li><strong>Rule B:</strong> However, if all of them are 'auto' and a
common ancestor of all the elements has a 'break-inside' value of
'avoid-region', then breaking here is not allowed.</li>
<li><strong>Rule C:</strong> Breaking at (2) is allowed only if the
number of <a href="/TR/CSS2/visuren.html#line-box">line boxes</a> between the
break and the start of the enclosing block box is the value of
'orphans' or more, and the number of line boxes between the break and
the end of the box is the value of 'widows' or more.</li>
<li><strong>Rule D:</strong> In addition, breaking at (2) or (3) is
allowed only if the 'break-inside' property of the element and all its
ancestors is 'auto'.</li>
</ul>
<p>If the above does not provide enough break points to keep content from
overflowing the region boxes, then rules A, B and D are dropped in order to
find additional breakpoints.</p>
<p>If that still does not lead to sufficient break points, rule C is
dropped as well, to find still more break points.</p>
<h4 id="forced-region-breaks">Forced region breaks</h4>
<p>A region break <em>must</em> occur at (1) if, among the 'break-after'
and 'break-before' properties of all the elements generating boxes that
meet at this margin, there is at least one with the value 'always', 'left',
or 'right'.</p>
<h4 id="best-region-breaks">"Best" region breaks</h4>
<p>CSS 2.1 does <em>not</em> define which of a set of allowed region
breaks must be used; CSS 2.1 does not forbid a user agent from
breaking at every possible break point, or not to break at all. But
CSS 2.1 does recommend that user agents observe the following
heuristics (while recognizing that they are sometimes contradictory):</p>
<ul>
<li>Break as few times as possible.</li>
<li>Avoid breaking inside a replaced element.</li>
</ul>
<div class="example">
<p style="display:none">Example(s):</p>
<p>Suppose, for example, that the style sheet contains 'orphans: 4',
'widows: 2', and there are 20 lines (<a href=
"/TR/CSS2/visuren.html#line-box">line boxes</a>) available at the bottom of the
current region:</p>
<ul>
<li>If a paragraph at the end of the current region contains 20
lines or fewer, it should be placed on the current region.</li>
<li>If the paragraph contains 21 or 22 lines, the second part of
the paragraph must not violate the <a href=
"/TR/CSS2/page.html#propdef-widows" class="noxref"><span class=
"propinst-widows">'widows'</span></a> constraint, and so the second
part must contain exactly two lines</li>
<li>If the paragraph contains 23 lines or more, the first part
should contain 20 lines and the second part the remaining
lines.</li>
</ul>
<p>Now suppose that <a href="/TR/CSS2/page.html#propdef-orphans" class=
"noxref"><span class="propinst-orphans">'orphans'</span></a> is '10',
<a href="/TR/CSS2/page.html#propdef-w
6777
idows" class="noxref"><span class=
"propinst-widows">'widows'</span></a> is '20', and there are 8 lines
available at the bottom of the current region:</p>
<ul>
<li>If a paragraph at the end of the current region contains 8
lines or fewer, it should be placed on the current region.</li>
<li>If the paragraph contains 9 lines or more, it cannot be split
(that would violate the orphan constraint), so it should move as a
block to the next region.</li>
</ul>
</div>
<h3 id="the-visual-formatting-model-and-flows">The Visual Formatting Model
and Flows</h3>
<p>This section describes the flows to which elements formatted according
to the CSS <a href="http://www.w3.org/TR/CSS21/visuren.html">Visual
Formatting Model</a> and other layout modules (such as Multi-Column Layout
[[!CSS3COL]]) belong to.</p>
<p>In particular, this section describes the 'generated flow' where
generated content of pseudo-elements is placed and several <dfn id=
"auto-flows" title="auto flows">'auto flows'</dfn> where children of content
elements are automatically placed.</p>
<h4 id="normal-flow">Normal flow</h4>
<p>In the CSS formatting model, elements are by default placed in the
<dfn id="normal-flow-def">normal flow</dfn> of their container. Also by
default, a container element gets its content from its <em>normal
flow</em>. This means that by default, a container element will visually
format its children elements and will be the only container associated with
its normal flow.</p>
<p>Note that floats and relatively positioned elements, in this model, are
part of the same flow of content and flow into the same container but are
positioned in different ways.</p>
<p>The <em>normal flow</em> is one of the <em>auto flows</em>.</p>
<h4 id="positioned-flow">Positioned flow</h4>
<p>An absolutely positioned element is placed into the <dfn title=
"positioned-flow">positioned flow</dfn> of its container. The container
positions this element into its <em>containing block</em>.</p>
<p>If a container has children in the <em>normal flow</em> and in the
<em>positioned flow</em>, it applies different positioning schemes to each
flow.</p>
<p>The <em>positioned flow</em> is one of the <em>auto flows</em>.</p>
<h4 id="column-flow">Column flow</h4>
<p>Children of the multi-column element are placed in the element's
<dfn id="column-flow-def">column flow</dfn>. The column boxes are then
implicitly associated with the element's 'column flow'. In this model,
multiple regions (column boxes) get their content from a single flow (the
element's 'column flow', which is the content of the element).</p>
<p>The <em>column flow</em> is one of the <em>auto flows</em>.</p>
<div class="issue">
Need to add a <dfn id="grid-cell-flow">grid cell flow</dfn> section.
</div>
<div class="issue">
Need to add examples for the different flow types.
</div>
<h4 id="generated-flow">Generated flow</h4>
<p>In the CSS formatting model, when the ''::before'' or ''::after''
pseudo-elements have their content property set to one of
''<string>'', ''<uri>'', ''<counter>'',
''attr(<identifier>)'', ''open-quote'', ''close-quote'',
''no-open-quote'' or ''no-close-quote'', they create a <dfn id=
"generated-flow-def">generated flow</dfn> which they format visually.</p>
<h3 id="relation-to-document-events">Relation to document events</h3>
<p>The CSS Region module does not alter in any way the normal processing of
events in the document tree. In particular, if an event occurs on an
element that is part of a named flow, the <a href=
"http://www.w3.org/TR/DOM-Level-3-Events/#dom-event-architecture">event's
bubble and capture phases</a> happen following the document tree order.</p>
<div class="issue">
<p>Should we consider having something to be able to add event
listeners to a region to detect events happening in the range of the
flow it positions?</p>
<pre class="code">
<script>
var region = ...; // get DOM r
8096
eference to region
region.addEventListener('click', function (evt) {
alert('I was able to capture an event from the flow content!');
}, true /* useCapture */);
region.addEventListener('click', function (evt) {
alert('I was able to see an event bubble from the flow content!');
}, false /* useCapture */);
</pre>
<p>Note that this is a complex proposition since it modifies the normal
bubble and capture event propagation model. However, it seems that it
would be a worthwhile feature.</p>
</div>
<h2 id="properties-and-rules">Properties and Rules</h2>
<p>The main CSS Regions module properties are the ‘flow’ and 'content'
properties. The ‘flow’ property places an element into a specific named
flow or lets the <a href="#auto-flows">automatic flow assignment</a> take
place. The ‘content’ property binds a region with a flow. When multiple
regions are bound to the same flow, the 'content-order' property determines
the order in which content flows into the sequence of regions. This
sequences of regions is called a <dfn>region chain</dfn>.</p>
<p> </p>
<p>The way in which the content is broken into segments that fit in a
region can be controlled by the “break” properties. Finally, styling that
is unique to the region can be specified by ‘region-style’ rules.</p>
<h3 id="the-flow-property">The 'flow' property</h3>
<p>The ‘flow’ property places an element into a named flow or automatically
places it in the appropriate flow (see the Visual Formatting Model and Flows
section). Elements that belong to the same flow are laid out in the regions
associated with that flow.</p>
<table class="propdef" summary="flow property definition">
<tr>
<th>Name:</th>
<td><dfn id="flow2">flow</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><string></td>
</tr>
<tr>
<th>Initial:</th>
<td>auto</td>
</tr>
<tr>
<th>Applies to:</th>
<td>any element</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>as specified</td>
</tr>
</table>
<dl>
<dt>auto</dt>
<dd>The element is automatically moved to the appropriate flow
according to the Visual
Formatting Model and Flows definitions.</dd>
<dt><string></dt>
<dd>The element is placed (appended) to the flow with that name. The
element is said to have a <dfn id="specified-flow">specified
flow</dfn>.</dd>
</dl>
<div class="issue">
Should the 'flow' property be an identifier and not a string?
</div>
<p>A named flow needs to be associated with one or more regions for its
elements to be visually formatted. If no region is associated with a given
named flow, the elements in the named flow are not rendered: they do not
generate boxes and are not displayed.</p>
<p>The children of an element with a specified flow may themselves have a
specified flow.</p>
<p>If an element has a the same specified flow value as one of its
ancestors, it is moved out of its parent's normal flow and becomes a
sibling of it's ancestor for the purpose of layout in the regions taking
content from this flow.</p>
<p>The 'flow' property does not affect the CSS cascade and inheritance for
the elements on which it is specified. The flow property affects the visual
formatting of elements associated to a named flow and of regions getting
their content from a named flow.</p>
<p>The containing block for absolutely positioned descendants of an element
with a specified flow is the region into which the element is rendered.</p>
<p>All the elements participating inside a named flow are rendered as
children of an anonymous block that spans across all the regions associated
with the specified named flow. The elements flowed inside the same named
flow are taken in document order.</p>
<p><span title="region">Regions</span> create a new stacking context, but
inherit the floats that are already defined by the parent context.</p>
<div class="example">
<p>In the following example, the inline content coming from the
<code class="html">content</code> <span title="named-flow">named
flow</span> wraps around the <code class="html">#float</code> box.</p>
<pre>
<style>
#float {
float: left;
width: 100px;
height: 300px;
}
#region1, #region2 {
width: 200px;
height: 200px;
content: from-flow(body_text);
}
#content {
flow: body_text;
}
</style>
<div id="float"></div>
<div id="region1"></div>
<div id="region2"></div>
<div id="content"></div>
</pre>
</div>
<h3 id="the-content-property">The 'content' property</h3>
<p>This specification extends the definition of the 'content' property and
makes it applicable to all block elements and pseudo-elements.</p>
<table class="propdef" summary="content property definition">
<tr>
<th>Name:</th>
<td><dfn id="content-from">content</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td>normal | none | from-flow(<string>)| [ <string> |
<uri> | <counter> | attr(<identifier>) |
open-quote | close-quote | no-open-quote | no-close-quote ]+ |
inherit</td>
</tr>
<tr>
<th>Initial:</th>
<td>normal</td>
</tr>
<tr>
<th>Applies to:</th>
<td>non-replaced block elements and the ::before and ::after
pseudo-elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>as specified</td>
</tr>
</table>
<dl>
<dt><a name="x9" id="x9"><span class="index-inst" title=
"none"><strong>none</strong></span></a></dt>
<dd>For ''::before'' and ''::after'' pseudo-elements, the
pseudo-element is not generated. For other elements, the element will
not get any content for its visual formatting. If the children of the
element are not directed to a flow referenced by another region, then
they are not visually formatted. An element with its value set to
'none' is said to be <dfn>disconnected</dfn></dd>
<dt><strong>normal</strong></dt>
<dd>Computes to 'none' for the ''::before'' and ''::after''
pseudo-elements. For other elements, the element uses the flow assigned
to its children following the <a href="#auto-flows">automatic flow
assignment for the Visual Formatting Model..</a></dd>
<dt><strong><string></strong></dt>
<dd>Text content (see the section on <a href=
"/TR/CSS2/syndata.html#strings">strings</a>).</dd>
<dt><strong><uri></strong></dt>
<dd>The value is a URI that designates an external resource (such as an
image). If the user agent cannot display the resource it must either
leave it out as if it were not specified or display some indication
that the resource cannot be displayed.</dd>
<dt><strong><counter></strong></dt>
<dd><a href="/TR/CSS2/syndata.html#counter">Counters</a> may be specified with
two different functions: 'counter()' or 'counters()'. The former has
two forms: 'counter(<var>name</var>)' or 'counter(<var>name</var>,
<var>style</var>)'. The generated text is the value of the innermost
counter of the given name in scope at this pseudo-element; it is
formatted in the indicated style
('decimal' by default). The latter function also has two forms:
'counters(<var>name</var>, <var>string</var>)' or
'counters(<var>name</var>, <var>string</var>, <var>style</var>)'. The
generated text is the value of all counters with the given name in
scope at this pseudo-element, from outermost to innermost separated by
the specified string. The counters are rendered in the indicated
style ('decimal' by default). See the
section on <a href="#counters">automatic counters and numbering</a> for
more information. The name must not be 'none', 'inherit' or 'initial'.
Such a name causes the declaration to be ignored.</dd>
<dt><strong>open-quote</strong> and <strong>close-quote</strong></dt>
<dd>These values are replaced by the appropriate string from the
<a href="http://www.w3.org/TR/CSS21/generate.html#propdef-quotes"
class="noxref"><span class=
"propinst-quotes"><strong>'quotes'</strong></span></a> property.</dd>
<dt><strong>no-open-quote</strong> and
<strong>no-close-quote</strong></dt>
<dd>Introduces no content, but increments (decrements) the level of
nesting for quotes.</dd>
<dt><strong>attr(X)</strong></dt>
<dd>This function returns as a string the value of attribute X for the
subject of the selector. The string is not parsed by the CSS processor.
If the subject of the selector does not have an attribute X, an empty
string is returned. The case-sensitivity of attribute names depends on
the document language.</dd>
<dt><dfn id="from-flow-name">from-flow(<string>)</dfn></dt>
<dd>The element will visually format the available elements in the
named flow with name <string>. If there is no flow with name
<string>, then the element is disconnected and does not format
any children visually. Multiple elements may be associated with the
same named flow. See the 'content-order' property discussion to
understand how content segments are associated with different
regions.</dd>
</dl>
<div class="note">
<p>The 'content' property applies to block-level elements and the
'::before' and '::after' pseudo elements. User agents may apply the
content property to inline elements. The behavior is undefined in that
case, but is generally expected to be similar to that of inline
'::before' and '::after' pseudo-elements.</p>
<p>In particular, note that the behavior of a '::before' or '::after'
pseudo-element with a 'display' value that makes it an inline element
combined with a 'content' value set to 'from-flow(<name>)' is
undefined.</p>
</div>
<div class="issue">
<p>Should we consider adding the ability to do the following:</p>
<ul>
<li>Support repeatable content. For example, have a repeatable
heading at the start of each region where content flows.</li>
<li>Support flow breaking marks. It might be very useful to support
a <em>mark</em> (such as "<code class="html">...</code>") at the
region breaking points to indicate that content has been broken out
and is continuing on a different region.</li><!--
<li>Support "atomic pull-outs". For example, we could have a named
flow made of a set of atomic quotes that should be placed, one by
one, in discrete regions. In that use case, we would need a
property to specify that content should be taken atomically from
the flow. May be something like the following.
<pre class="code">
<div id="quote_1" class="quote">...</div>
...
<div id="quote_n" class="quote">...</div>
<div id="pull-out-1" class="pull-out"></div>
...
<div id="pull-out-n" class="pull-out"></div>
<style>
.quote {
flow: "quotes";
}
.pull-out {
content: from-flow(quotes);
content-consume: atomic;
}
</style>
</pre>
</li>
-->
</ul>
</div>
<div class="issue">
<p><a href=
"http://lists.w3.org/Archives/Public/www-style/2011May/0521.html">Mailing
list comment</a></p>
<p>''content: from-flow(<name>)'' moves an element to a named
flow. Should we allow the content to be copied to a flow instead of
moved to a flow. For example:</p>
<div class="code">
#quote_A { flow: "quotes"; content: contents; }
</div>
<p>would keep ''#quote_A'' in the normal flow but also copy its content
to the ''quotes'' flow. This essentially clones the node and raises
questions regarding DOM access, CSSOM View and the computed style.</p>
</div>
<h3 id="the-conte
23B3
nt-order-property">The 'content-order' property</h3>
<p>Defines the ordering of the chain of regions into which content flows.
If region A and region B are in the same chain of regions and the
‘content-order’ of region A is lower than that of region B, then region A
will precede region B in that chain: content will flow into region A before
it flows into region B.</p>
<table class="propdef" summary="content-order property definition">
<tr>
<th>Name:</th>
<td><dfn id="content-order">content-order</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><float></td>