-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.html
More file actions
1182 lines (1025 loc) · 46.3 KB
/
Overview.html
File metadata and controls
1182 lines (1025 loc) · 46.3 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 lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;utf-8" />
<title>CSS3 Text Layout Module</title>
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/tr/W3C-ED.css" />
<style type="text/css">
.data, .proptable {
margin: 1em auto;
border-collapse: collapse;
border: solid #005A9B;
}
.data caption {
width: 100%;
text-align: center;
}
.data td, .data th,
.proptable td, .proptable th {
border: thin solid;
padding: 0.2em;
text-align: center;
}
.data thead th[scope="row"],
.proptable thead th[scope="row"] {
text-align: right;
background: #A4C8E2;
color: inherit;
}
.data thead,
.proptable thead {
background: #EEEEEE;
color: inherit;
}
.data tbody th:first-child,
.proptable tbody th:first-child {
text-align: right;
background: #EEEEEE;
color: inherit;
}
.data thead,
.data tbody,
.data tfoot,
.data colgroup {
border: solid;
}
table.propdef {
table-layout: auto;
}
.propdef th {
font-style: italic;
font-weight: normal;
text-align: left;
width: 3em;
}
dt dfn code {
font-size: inherit;
}
.egbidiwsaA,.egbidiwsbB,.egbidiwsaB,.egbidiwsbC
{ white-space:pre;font-size:80%;font-family:monospace; vertical-align:2px; margin:1px }
.egbidiwsaA { background:lime;padding:2px; }
.egbidiwsbB { border:2px solid blue }
.egbidiwsaB { background:yellow;border:2px dotted white }
.egbidiwsbC { border:2px dotted red }
</style>
</head>
<body>
<div class="head">
<p>
<a href="http://www.w3.org/Style/Group/css3-src/css3-text-layout/">
<img src="http://www.w3.org/Icons/w3c_home" alt="W3C" name="w3cLogo" height="48" width="72" />
</a>
</p>
<h1>CSS3 Text Layout Module</h1>
<h2 class="no-num no-toc">Editor's Draft</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://dev.w3.org/csswg/css3-text-layout/">http://dev.w3.org/csswg/css3-text-layout/</a>
<dt>Latest version:</dt>
<dd><a
href="http://www.w3.org/tr/css3-text-layout/">http://www.w3.org/tr/css3-text-layout/</a></dd>
<dt>previous version:</dt>
<dd><a
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/">http://www.w3.org/tr/2003/CR-css3-text-20030514/</a></dd>
<dt>Editor:</dt>
<dd><a href="mailto:paulnel@microsoft.com">Paul Nelson</a> (<a href="http://www.microsoft.com/">Microsoft</a>)</dd>
<dt>previous Editor:</dt>
<dd><a href="mailto:michelsu@microsoft.com">Michel Suignard</a> (<a href="http://www.microsoft.com/">Microsoft</a>)</dd>
</dl>
<p class="copyright"><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
Copyright</a> © 2005 <a href="http://www.w3.org/"><abbr title="World
Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><abb
3419
r title="Massachusetts Institute of
Technology">MIT</abbr></a>, <a href="http://www.ercim.org/"><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>
<hr title="Separator for header" />
</div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>This module specifies the text layout model in CSS and the properties
that control it. It covers bidirectionality, vertical text, grid layout,
and other special inline text layout effects.</p>
<h2 class="no-num no-toc" id="status">Status of this document</h2>
<p>This document is a <strong>Working Draft</strong>. <strong>This draft has not been approved or endorsed by
the W3C or the CSS Working Group in any way</strong> and you may not use
it as a reference or cite it other than as a work in progress. It may
be updated, replaced or rendered obsolete at any time by subsequent
publications.</p>
<h2 class="no-num no-toc" id="Contents">Contents</h2><!--begin-toc-->
<ul class="toc">
<li><a
href="#introduction"><span
class="secno">1. </span>Text layout introduction</a></li>
<li><a
href="#textflow"><span
class="secno">2. </span>Text flow</a>
<ul class="toc">
<li><a
href="#text-direction"><span
class="secno">2.1. </span>Inline progression : the 'direction' and 'unicode-bidi' properties</a></li>
<li><a
href="#block-progression"><span
class="secno">2.2. </span>Block progression: the 'block-progression' property</a></li>
</ul>
</li>
<li><a href="#document-grid"><span
class="secno">3. </span>Document grid</a>
<ul class="toc">
<li><a href="#grid-introduction"><span
class="secno">3.1. </span>Document grid introduction</a></li>
<li><a href="#line-grid-mode-prop"><span
class="secno">3.2. </span>Line grid mode: the <span
class="property">'line-grid-mode'</span> property</a></li>
<li><a href="#line-grid-mode-prop"><span
class="secno">3.3. </span>Line grid progression: the <span
class="property">'line-grid-progression'</span> property</a></li>
<li><a href="#line-grid-prop"><span
class="secno">3.4. </span>Line grid: the <span
class="property">'line-grid'</span> shorthand property</a></li>
</ul>
</li>
</ul>
<h2 id="introduction"><span class="secno">1.</span> Text layout introduction</h2>
<p>This section describes the text layout features supported by CSS, which
includes support for various international writing directions, such as
left-to-right (e.g., Latin scripts), right-to-left (e.g., Hebrew or Arabic),
bidirectional (e.g., mixing Latin with Arabic) and vertical (e.g., Asian
scripts). In addition, this section defines a set of properties that provide
for a document grid layout system that is commonly used with East Asian text
layout.</p>
<h2 id="text-flow"><span class="secno">2.</span> Text flow</h2>
<p>Text flow is defined in terms of inline progression and block progression.
Inline progression is the way elements flow on the line and defines on which
end of the line the "start" and "end" are located. The <span class="property">
<a href="#direction">'direction'</a></span> and <span class="property">
<a href="#unicode-bidi">'unicode-bidi'</a></span> properties determine the
inline-progression and bidirectional layout. The <span class="property">
<a href="#block-progression">'block-progression'</a></span> property
determines the line progression, or way lines stack, in a block. The
<span class="property"><a href="#writing-mode">'writing-mode'</a></span>
shorthand combines inline and block progression together. </p>
<p>Some examples of text flow are: </p>
<ul>
<li>Latin scripts are typically written using a left to right inline progression
with a top to bottom block progression.</li>
<li>Mongolian script languages are typically written using a top to bottom
inline progression with a left to right block progression.</li>
<li>Japanese is commonly written using both a left to right inline progression
with a top to bottom block progression, <strong>and</strong> a top to bottom
inline progression with a right to left block progression. Many magazines
and newspapers will mix these two text flows on the same page.</li>
</ul>
<h3 id="text-direction"><span class="secno">2.1.</span> Inline progression:
the <span class="propinst-direction">'direction'</span>
and <span class="propinst-unicode-bidi">'unicode-bidi'</span>
properties</h3>
<p><a href="conform.html#conformance">Conforming</a> user agents that do
not support bidirectional text may ignore the <span
class="propinst-direction">'direction'</span> and <span
class="propinst-unicode-bidi">'unicode-bidi'</span> properties
described in this section. This exception includes UAs that render
right-to-left characters simply because a font on the system contains them
but do not support the concept of right-to-left text direction.</p>
<p>The characters in certain scripts are written from right to
left. In some documents, in particular those written with the Arabic
or Hebrew script, and in some mixed-language contexts, text in a
single (visually displayed) block may appear with mixed
directionality. This phenomenon is called <span class="index-def"
title="bidirectionality (bidi)"><dfn>bidirectionality</dfn></span>, or
"bidi" for short.</p>
<p>The Unicode standard (<a href="http://www.unicode.org/reports/tr9/">Unicode Standard Annex #9</a>) defines a complex
algorithm for determining the proper directionality of text. The
algorithm consists of an implicit part based on character properties,
as well as explicit controls for embeddings and overrides. CSS relies
on this algorithm to achieve proper bidirectional rendering. The <span
class="propinst-direction">'direction'</span> and <span
class="propinst-unicode-bidi">'unicode-bidi'</span> properties allow
authors to specify how the elements and attributes of a document
language map to this algorithm.</p>
<p>User agents that support bidirectional text must apply the Unicode
bidirectional algorithm to every sequence of inline boxes uninterrupted
by a forced line break or block boundary. This sequence forms the
"paragraph" unit in the bidirectional algorithm. The paragraph embedding
level is set according to the value of the <span
class="propinst-direction">'direction'</span> property of the containing
block rather than by the heuristic given in steps P2 and P3 of the Unicode
algorithm.</p>
<p>Because the directionality of a text depends on the structure and
semantics of the document language, these properties should in most
cases be used only by designers of document type descriptions (Dtds),
or authors of special documents. If a default style sheet specifies
these properties, authors and users should not specify rules to
override them.</p>
<p>The HTML 4 specification ([HTML4], section 8.2) defines
bidirectionality behavior for HTML elements. The style sheet
rules that would achieve the bidi behaviors specified in [[HTML4]] are
given below. The HTML 4 specification also contains more information on
bidirectionality issues.</p>
<pre>
*[dir="ltr"] { direction: ltr; unicode-bidi: embed; }
*[dir="rtl"] { direction: rtl; unicode-bidi: embed; }
bdo[dir="ltr"] { direction: ltr; unicode-bidi: bidi-override; }
bdo[dir="rtl"] { direction: rtl; unicode-bidi: bidi-override; }
</pre>
<p><b>Note: </b>Because HTML UAs can turn off CSS styling, we advise HTML
authors to use the HTML 'dir' property and <bdo> element to
ensure correct bidirectional layout in the absence of a style sheet.</p>
<!-- #include src=properties/direction.srb -->
<div class="propdef">
<dl>
<dt>
<span class="index-def" title="'direction'">
<a name="propdef-direction" class="propdef-title"><strong>'direction'</strong></a></span>
</dt>
<dd></dd>
</dl>
<table class="propinfo" cellspacing="0" cellpadding="0">
<tr valign="baseline">
<td><em>Value:</em> </td>
<td>ltr | rtl | <a href="cascade.html#value-def-inherit" class="noxref">
<span class="value-inst-inherit">inherit</span></a></td>
</tr>
<tr valign="baseline">
<td><em>Initial:</em> </td>
<td>ltr
</td>
</tr>
<tr valign="baseline">
<td><em>Applies to:</em> </td>
<td>all elements, but see prose</td>
</tr>
<tr valign="baseline">
<td><em>Inherited:</em> </td>
<td>yes
</td>
</tr>
<tr valign="baseline">
<td><em>Percentages:</em> </td>
<td>N/A
</td>
</tr>
<tr valign="baseline">
<td><em>Media:</em> </td>
<td><a href="media.html#visual-media-group" class="noxref">visual</a>
</td>
</tr>
<tr valign="baseline">
<td><em>Computed value:</em> </td>
<td>as specified
</td>
</tr>
</table>
</div>
<p>This property specifies the inline progression of text and elements
on a line, and the direction of embeddings and overrides (see <span
class="propinst-unicode-bidi">'unicode-bidi'</span>) for the Unicode
bidirectional algorithm. In addition, it specifies the direction of <a
href="http://www.w3.org/TR/2006/WD-CSS21-20060411/tables.html">table</a> column layout, the direction of
horizontal <a href="http://www.w3.org/TR/2006/WD-CSS21-20060411/visufx.html#overflow">overflow</a>, and the
position of an incomplete last line in a block in case of 'text-align:
justify'.</p>
<p>Values for this property have the following meanings:</p>
<dl>
<dt><strong>ltr</strong></dt>
<dd>Left-to-right direction.</dd>
<dt><strong>rtl</strong></dt>
<dd> Right-to-left direction.</dd>
</dl>
<p>For the <span class="propinst-direction">'direction'</span>
property to affect reordering in inline-level elements, the <span
class="propinst-unicode-bidi">'unicode-bidi'</span> property's value
must be 'embed' or 'override'.</p>
<div class="note">
<p><em><strong>Note.</strong>
The <span class="propinst-direction">'direction'</span> property, when
specified for table column elements, is not inherited by cells in the
column since columns are not the ancestors of the cells in the document tree.
Thus, CSS cannot easily capture the "dir" attribute inheritance rules described
in [[HTML4]], section 11.3.2.1.
</em></p>
</div>
<!-- #include src=properties/unicode-bidi.srb -->
<div class="propdef">
<dl>
<dt>
<span class="index-def" title="'unicode-bidi'">
<a name="propdef-unicode-bidi" class="propdef-title"><strong>'unicode-bidi'</strong></a></span>
</dt>
<dd></dd>
</dl>
<table class="propinfo" cellspacing="0" cellpadding="0">
<tr valign="baseline">
<td><em>Value:</em> </td>
<td>normal | embed | bidi-override</td>
</tr>
<tr valign="baseline">
<td><em>Initial:</em> </td>
<td>normal
</td>
</tr>
<tr valign="baseline">
<td><em>Applies to:</em> </td>
<td>all elements and generated content, but see</td>
</tr>
<tr valign="baseline">
<td><em>Inherited:</em> </td>
<td>no
</td>
</tr>
<tr valign="baseline">
<td><em>Percentages:</em> </td>
<td>N/A
</td>
</tr>
<tr valign="baseline">
<td><em>Media:</em> </td>
<td><a href="http://www.w3.org/TR/2006/WD-CSS21-20060411/media.html#visual-media-group" class="noxref">visual</a>
</td>
</tr>
<tr valign="baseline">
<td><em>Computed value:</em> </td>
<td>specified (except for initial and inherit)
</td>
</tr>
</table>
</div>
<p>Values for this property have the following meanings:</p>
<dl>
<dt><strong>normal</strong></dt>
<dd>The element does not open an additional level of embedding with
respect to the bidirectional algorithm. For inline-level elements,
implicit reordering works across element boundaries.</dd>
<dt><strong>embed</strong></dt>
<dd>If the element is inline-level, this value
opens an additional level of embedding with respect to the
bidirectional algorithm. The direction of this embedding level is
given by the <span class="propinst-direction">'direction'</span>
property. Inside the element, reordering is done implicitly. This
corresponds to adding a LRE (U+202A; for 'direction: ltr') or RLE
(U+202B; for 'direction: rtl') at the start of the element and a PDF
(U+202C) at the end of the element.</dd>
<dt><strong>bidi-override</strong></dt>
<dd>For inline-level elements this creates an override.
For block-level, table-cell, table-caption, or inline-block elements
this creates an override for inline-level descendents not within
another block-level, table-cell, table-caption, or inline-block
element. This means that inside the element, reordering is strictly in sequence
according to the <span class="propinst-direction">'direction'</span>
property; the implicit part of the bidirectional algorithm is
ignored. This corresponds to adding a LRO (U+202D; for 'direction:
ltr') or RLO (U+202E; for 'direction: rtl') at the start of the
element and a PDF (U+202C) at the end of the element.</dd>
</dl>
<p>The final order of characters in each block-level element is the
same as if the bidi control codes had been added as described above,
markup had been stripped, and the resulting character sequence had
been passed to an implementation of the Unicode bidirectional
algorithm for plain text that produced the same line-breaks as the
styled text. In this process, non-textual entities such as images are
treated as neutral characters, unless their <span
class="propinst-unicode-bidi">'unicode-bidi'</span> property has a
value other than 'normal', in which case they are treated as strong
characters in the <span class="propinst-direction">'direction'</span>
specified for the element.</p>
<p>Please note that in order to be able to flow inline boxes in a
uniform direction (either entirely left-to-right or entirely
right-to-left), more inline boxes (including anonymous inline boxes)
may have to be created, and some inline boxes may have to be split up
and reordered before flowing.</p>
<p>Because the Unicode algorithm has a limit of
<em title="According to unicode 3.0, chapter 3, section 12, definition BD2.
Specifically, page 58 here: http://www.unicode.org/unicode/uni2book/ch03.pdf">
61 levels</em> of embedding, care should be taken not to use <span
class="propinst-unicode-bidi">'unicode-bidi'</span> with a value other
than 'normal' unless appropriate. In particular, a value of 'inherit'
should be used with extreme caution. However, for elements that are,
in general, intended to be displayed as blocks, a setting of
'unicode-bidi: embed' is preferred to keep the element together in
case display is changed to inline (see example below).</p>
<p>The following example shows an XML document with bidirectional
text. It illustrates an important design principle: <span
class="index-inst" title="Dtd">Dtd</span> designers should take bidi
into account both in the language proper (elements and attributes) and
in any accompanying style sheets. The style sheets should be designed
so that bidi rules are separate from other style rules. The bidi rules
should not be overridden by other style sheets so that the document
language's or Dtd's bidi behavior is preserved.</p>
<div class="example">
<p>In this example,
lowercase letters stand for inherently left-to-right characters and
uppercase letters represent inherently right-to-left characters. The
text stream is shown in logical backing store order.</p>
<pre class="xml-example"><code class="xml">
<HEBREW>
<PAR>HEBREW1 HEBREW2 english3 HEBREW4 HEBREW5</PAR>
<PAR>HEBREW6 <EMPH>HEBREW7</EMPH> HEBREW8</PAR>
</HEBREW>
<ENGLISH>
<PAR>english9 english10 english11 HEBREW12 HEBREW13</PAR>
<PAR>english14 english15 english16</PAR>
<PAR>english17 <HE-QUO>HEBREW18 english19 HEBREW20</HE-QUO></PAR>
</ENGLISH>
</code></pre>
<p>Since this is XML, the style sheet is responsible for setting the
writing direction. This is the style sheet:</p>
<pre class="example">
/* Rules for bidi */
HEBREW, HE-QUO {direction: rtl; unicode-bidi: embed;}
ENGLISH {direction: ltr; unicode-bidi: embed;}
/* Rules for presentation */
HEBREW, ENGLISH, PAR {display: block;}
EMPH {font-weight: bold;}
</pre>
<p>The HEBREW element is a block with a right-to-left base direction,
the ENGLISH element is a block with a left-to-right base
direction. The PARs are blocks that inherit the base direction from
their parents. Thus, the first two PARs are read starting at the top
right, the final three are read starting at the top left. Please note
that HEBREW and ENGLISH are chosen as element names for explicitness
only; in general, element names should convey structure without
reference to language.</p>
<p>The EMPH element is inline-level, and since its value for <span
class="propinst-unicode-bidi">'unicode-bidi'</span> is 'normal' (the
initial value), it has no effect on the ordering of the text. The
HE-QUO element, on the other hand, creates an embedding.</p>
<p>The formatting of this text might look like this if the line length
is long:</p>
<pre class="ascii-art">
5WERBEH 4WERBEH english3 2WERBEH 1WERBEH
8WERBEH <b>7WERBEH</b> 6WERBEH
english9 english10 english11 13WERBEH 12WERBEH
english14 english15 english16
english17 20WERBEH english19 18WERBEH
</pre>
<p>Note that the HE-QUO embedding causes HEBREW18 to be to the right
of english19.</p>
<p>If lines have to be broken, it might be more like this:</p>
<pre class="ascii-art">
2WERBEH 1WERBEH
-EH 4WERBEH english3
5WERB
-EH <b>7WERBEH</b> 6WERBEH
8WERB
english9 english10 en-
glish11 12WERBEH
13WERBEH
english14 english15
english16
english17 18WERBEH
20WERBEH english19
</pre>
<p>Because HEBREW18 must be read before english19, it is on the line
above english19. Just breaking the long line from the earlier
formatting would not have worked. Note also that the first syllable
from english19 might have fit on the previous line, but hyphenation of
left-to-right words in a right-to-left context, and vice versa, is
usually suppressed to avoid having to display a hyphen in the middle
of a line.</p>
</div><!-- example -->
<h3 id="block-progression"><span class="secno">2.2.</span> Block progression: the 'block-progression' property</h3>
<table class="propdef">
<tbody>
<tr>
<th>Name:</th>
<td><dfn>block-progression</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td>tb | rl | lr</td>
</tr>
<tr>
<th>Initial:</th>
<td>tb</td>
</tr>
<tr>
<th>Applies to:</th>
<td><span class="issue">??</span></td>
</tr>
<tr>
<th>Inherited:</th>
<td>yes</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>specified value</td>
</tr>
</tbody>
</table>
<p class="issue">Should we change the name to something more understandable?
"block-flow"? "block-direction"? We need to make sure terminology for
inline progression and block progression ("layout" vs "flow" vs "orientation"
vs "direction", "horizontal" vs "vertical") is consistent throughout the
document as well.)</p>
<p>This property sets the block-progression value and the layout orientation.
Possible values:</p>
<dl>
<dt>tb</dt>
<dd>Top-to-bottom block flow. The layout orientation is horizontal.</dd>
<dt>rl</dt>
<dd>Right-to-left block flow. The layout orientation is vertical.</dd>
<dt>lr</dt>
<dd>Left-to-right block flow. The layout orientation is vertical.</dd>
</dl>
<p>An inline-level element that has a different 'block-progression' from
its containing block becomes an 'inline-block' element <a href="#CSS3-box" rel="biblioentry">[CSS3-box]</a>.
<span class="issue">switch to CSS2.1</span></p>
<h3>Details</h3>
<p>Box layout in vertical orientations is exactly analogous to layout in
the horizontal orientation.</p>
<ul>
<li>Calculations that refer to 'width' use 'height' instead, and vice
versa.</li>
<li>Calculations that refer to the '*-left' and '*-right' box properties
(border, margin, padding, outline) use '*-top' and '*-bottom'
instead, and vice versa. In RL layout '*-right' is analogous to
TB's '*-top'; in LR layout '*-left' is analogous to TB's '*-top'.
The logic for this is clear if you lock an arrow representing the
TB block flow to a compass of the four directions and rotate it to
represent RL and LR flow.</li>
<li>Layout effects that depend on the directionality to choose between
left and right (e.g. overflow, overconstraint resolution, 'start'
values for 'text-align' and other properties, table column ordering)
depend instead on the effective physical directionality
(top-to-bottom or bottom-to-top) to choose between top and bottom.</li>
</ul>
<p>When an element has a different 'block-progression' from its
containing block two cases are possible:</p>
<em class="issue">These descriptions need work</em>
<ul>
<li>The two block-progressions are perpendicular to each other. (For
example, 'tb' and 'lr'). In such cases, <span class="issue">detail
calculation of width/height and determination of containing block dim</span></li>
<li>The two block-progressions are parallel to each other. (For example,
'rl' and 'lr').</li>
</ul>
<h3>Example</h3>
<div class="example">
<p>In the following example, two blocks elements (1 and 3) separated
by an image (2) are presented in various flow orientations.</p>
<p>Here is a diagram of horizontal layout (<code>block-progression: tb</code>):</p>
<p><img alt="Diagram of horizontal layout: blocks 1, 2, and 3 are stacked top-to-bottom"
src="horizontal.png" width="219" height="300" /></p>
<p>Here is a diagram for the right-to-left vertical layout commonly
used in East Asia (<code>block-progression: rl</code>):</p>
<p><img alt="Diagram of a right-to-left vertical layout: blocks 1, 2,
and 3 are arranged side by side from right to left"
src="vertical-rl.png" height="191" width="297" /></p>
<p>And finally, here is a diagram for the left-to-right vertical
layout used for Uighur and Mongolian (<code>block-progression: lr</code>):</p>
<p><img alt="Diagram of left-to-right vertical layout: blocks 1, 2,
and 3 are arranged side by side from left to right"
src="vertical-lr.png" height="191" width="300" /></p>
<h3 id="writing-mode"><span class="secno">2.3.</span> Text flow short cut: the 'writing-mode' property</h3>
<table class="propdef" id="name-">
<tr>
<td><em>Name:</em></td>
<td><dfn id="writing-mode">writing-mode</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td>lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>not defined for shorthand properties</td>
</tr>
<tr>
<td><em>Applies to:</em></td>
<td>all elements and generated content</td>
</tr>
<tr>
<td><em>Inherited:</em></td>
<td>yes</td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual</td>
</tr>
<tr>
<td><em>Computed value:</em></td>
<td>see individual properties</td>
</tr>
</table>
<p>The <span class="property"><a
href="#writing-mode">'writing-mode'</a></span> property is a shorthand
property for the <span class="property"><a
href="#direction">'direction'</a></span> property and the <span class="property"> <a
href="#block-progression">'block-progression'</a></span> property. Although
strictly speaking, the property has no initial value, it is equivalent to 'lr-tb'.
The definition of the property values are established by the following table,
which shows the setting of the constituent properties and example of common
usage.</p>
<div class="figure">
<table border="1" style="border-collapse: collapse" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th>writing-mode:</th>
<th>direction:</th>
<th>block-progression:</th>
<th>Common Usage:</th>
</tr>
<tr>
<td>lr-tb</td>
<td>ltr</td>
<td>tb</td>
<td>Latin-based, Greek, Cyrillic writing systems (and many others)</td>
</tr>
<tr>
<td>rl-tb</td>
<td>rtl</td>
<td>tb</td>
<td>Arabic, Hebrew writing systems</td>
</tr>
<tr>
<td>tb-rl</td>
<td>ltr</td>
<td>rl</td>
<td>East Asian writing systems in vertical mode</td>
</tr>
<tr>
<td>bt-rl</td>
<td>ltr</td>
<td>rl</td>
<td>Arabic script block quote embedded in East Asian vertical text</td>
</tr>
<tr>
<td>tb-lr</td>
<td>ltr</td>
<td>lr</td>
<td>Mongolian script writing system</td>
</tr>
<tr>
<td>bt-lr</td>
<td>rtl</td>
<td>lr</td>
<td>Arabic script block quote embedded in Mongolian script document</td>
</tr>
</table>
</div>
<h3 id="writing-mode-mixed"><span class="secno">2.4.</span> Mixing the 'writing-mode' in normal usage</h3>
<p>In East Asian documents, it is often preferred to display certain
Latin-based strings, such as numerals in a year, always in a horizontal
layout orientation regardless of the flow orientation of the line of
text these strings appear in, as in:</p>
<div class="figure">
<p><img alt="Diagram of Tate Naka Yoko, showing a group of glyphs
appearing horizontally in a vertical column of text"
class="example" src="lf-tny.gif" height="170" width="90">
<img alt="Example of Tate Naka Yoko, showing the year 1996
appearing horizontally in a column of vertical text"
class="example" src="tny.gif" height="132" width="37">
<p>Horizontal in vertical ("<span lang="ja">Tate-chu-yoko</span>")
</div>
<p>In Japanese, this effect is known as
<a href="#tatechuyoko" lang="ja">"Tate-chu-yoko"</a>. In order to
achieve it in a CSS document, the Latin string should be enclosed
in an inline element with a horizontal layout orientation, as in:
<pre>.date {block-progression: tb;}
<!-- --><span class="date">1996</span></pre>
</div>
<h2 id="document-grid"><span class="secno">3. </span>Document grid</h2>
<h3 id="grid-introduction"><span class="secno">3.1. </span>Document grid introduction</h3>
<p>Documents written in East Asian languages, such as Chinese or Japanese,
are commonly laid out on the page according to a specified one- or
two-dimensional grid. The concept of grid can also be used with other
non-ideographic contexts such as Braille script or monospaced layout. </p>
<p>The diagram below represents a fragment of horizontal text on a page with
mixed wide-cell and narrow-cell glyphs that a Japanese content author intended
to be laid out on a grid system that has 9 glyphs per line. Gray grid lines
are shown for clarity):
<div class=figure>
<p><img class=example height=89
alt="Example of strict grid layout (genko) applied to mixed Japanese and English in horizontal layout."
src="lg-s-ex.gif" width=274> <br>
'<span lang=ja>Genko</span>' grid applied to mixed text </p>
</div>
<p>The grid behavior can be set on the inline-progression, on the
block-progression or both. The grid on the block-progression dimension is
determined by the following properties:</p>
<ul>
<li>'line-stacking-strategy' <a
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/#CSS3-line"
rel=biblioentry>[CSS3-line]</A> set to the 'grid-height' value, </li>
<li>'line-height' <a
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/#CSS3-line"
rel=biblioentry>[CSS3-line]</a> of the block element set to the desired grid
block-progression value,</li>
<li>'text-height' <a
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/#CSS3-line"
rel=biblioentry>[CSS3-line]</a> which defines the block-progression value for
inline boxes. Depending on the content size, one or a multiple of
'line-height' will be necessary to accommodate a given inline box. </LI>
</ul>
<p>The block-progression grid is not described in this section as it can be
achieved simply by using the properties mentioned above and described in the
CSS3 Line module.</p>
<p>The grid on the inline-progression dimension is obtained by altering the
glyphs advance width (or inline-progression value) of inline elements. There are
several modes:</p>
<ul>
<li>Adding extra space between each grapheme cluster by using the <span
class=property><a
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/#letter-spacing">'letter-spacing'</a></span>
property. This is sometimes called "loose" grid.</li>
<li>Giving a fixed advance width to ideograph grapheme clusters only. Other
grapheme clusters are spaced normally. This is called "<span
lang=ja>genko</span>" in Japanese typography. </li>
<li>Giving a fixed advance width to all grapheme clusters, excepted connected
glyphs (like Arabic). </li>
</ul>
<p>Two properties control this advance width modification: <span
class=property><a
href="#line-grid-mode">'line-grid-mode'</a></span>
enables it and <span class=property><a
href="#line-grid-progression">'line-grid-progression'</a></span>
determines its value. The shorthand <span class=property><a
href="#line-grid">'line-grid'</a></span>
allows setting both together.</p>
<h3 id=line-grid-mode-prop><span class="secno">3.2. </span>Line grid mode: the
<span class=property><A
href="#line-grid-mode">'line-grid-mode'</A></span>
property</h3>
<table class=propdef id=name-52>
<tbody>
<tr>
<td><em>Name:</em> </td>
<td><dfn id=line-grid-mode>line-grid-mode</dfn> </td>
</tr>
<tr>
<td><em>Value:</em> </td>
<td>none | ideograph | all</td>
</tr>
<tr>
<td><em>Initial:</em> </td>
<td>none</td>
</tr>
<tr>
<td><em>Applies to:</em> </td>
<td>block-level and inline-block elements </td>
</tr>
<tr>
<td><em>Inherited:</em> </td>
<td>yes </td>
</tr>
<tr>
<td><em>Percentages:</em> </td>
<td>N/A </td>
</tr>
<tr>
<td><em>Media:</em> </td>
<td><A class=noxref
href="http://www.w3.org/TR/2006/WD-CSS21-20060411/media.html#visual-media-group">visual</A> </td>
</tr>
<tr>
<td><em>Computed value:</em>
<td>specified value (except for initial and inherit)
</tr>
</tbody>
</table>
<p>Specifies the line grid behavior. Each line grid mode value entails a
different set of rules for rendering inline contents (the term 'horizontal' is
used in the following description to indicate the inline-progression dimension).
Possible values: </p>
<dl>
<dt>none </dt>
<dd>
<p>No line grid. Standard text alignments apply to the block element. </p>
</dd>
<dt>ideograph </dt>
<dd>Content is divided into units that we will call strips. Each strip is
horizontally centered within the smallest number of grid spaces that contain
the strip. The width of the grid space is determined by the <span
class=property><A
href="#line-grid-progression">'line-grid-progression'</A></span>
setting.
<p>Each grapheme cluster with a wide base character is a strip. Each grapheme
cluster with a narrow <A
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/#g-kana"><span
lang=ja>kana</span></A> character as its base is a strip. Each non-breakable
object (e.g. an image) is a strip. Other grapheme clusters are treated as a
single strip bounded by the strips described prior. That single strip may be
decomposed in several strips if line breaking occurs within it.</p>
<p>The strips are arranged in the grid as follows: <p>
<ul>
<li>Each strip corresponding to wide base character (as well as narrow <A
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/#g-kana"><span
lang=ja>kana</span></A> character) that can fit within a single grid space
is rendered in the horizontal center of the grid space. </li>
<li>Each strip corresponding to other characters are placed in the center of
the smallest number of grid spaces necessary for it to fit. If a line break
occurs within such a strip, the strip is treated as two or more separate
strips whose individual placement follows the same rules as those for a
single strip.</li>
<li>Strips corresponding to non-breakable objects and strips corresponding
to wide base character (as well as narrow <A
href="http://www.w3.org/tr/2003/CR-css3-text-20030514/#g-kana"><span
lang=ja>kana</span></A> character) that are wider than a single grid space,
are each centered within the smallest number of grid cells necessary for
them to fit. </li>
</ul>
<div class=figure>
<p><img class=example height=69 alt="Mixed glyph layout in strict grid"
src="lg-s.gif" width=282>
<p>Mixed glyph layout in strict grid </p>
</div>
<div class=figure>
<p><img class=example height=67
alt="Object layout in strict grid. Large rectangular object is centered horizontally within 2 grid spaces"
src="lg-s2.gif" width=282>
<p>Object layout in strict grid </p>
</div>
<p>The 'ideograph' mode disables all special text justification and glyph
width adjustment normally applied to the contents of the block element. </p>
<p>If a line break opportunity cannot be found in a text run going over the
line boundary, then that text run will be pushed down to the next line and the
last part of the previous line will be left blank. </p>
<div class=example>
<p>Here is an example of mixed text in 'ideograph' grid mode:
<div class=figure>
<p><img class=example height=89
alt="Example of strict grid applied to mixed Japanese and English text in horizontal layout"
src="lg-s-ex.gif" width=274>