-
Notifications
You must be signed in to change notification settings - Fork 792
Expand file tree
/
Copy pathOverview.html
More file actions
executable file
·4342 lines (3356 loc) · 169 KB
/
Overview.html
File metadata and controls
executable file
·4342 lines (3356 loc) · 169 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
31
8096
0
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<
F882
/div>
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">
<html lang=en>
<head profile="http://dublincore.org/documents/2008/08/04/dc-html/ ">
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Writing Modes Module Level 3</title>
<link href="http://purl.org/dc/terms/" rel=schema.dcterms>
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=dcterms.rights>
<meta content="CSS Writing Modes Module Level 3" name=dcterms.title>
<meta content=text name=dcterms.type>
<meta content=2013-06-17 name=dcterms.date>
<meta content="Elika J. Etemad" name=dcterms.creator>
<meta content="Koji Ishii" name=dcterms.creator>
<meta content=W3C name=dcterms.publisher>
<meta content="http://dev.w3.org/csswg/css3-writing-modes/"
name=dcterms.identifier>
<link href="../default.css" rel=stylesheet type="text/css">
<style type="text/css">
object { vertical-align: middle; }
.sidebar { float: right; background: #eee; border: solid gray; margin: 1em; }
.sidebar .figure { margin: 1em; }
.sidebar object { margin: 0 auto; display: block; }
.figurepair { display: table; margin: 1em auto; }
.figurepair .figure { display: table-cell; }
h2, .example { clear: both; }
.figure img,
.figure object,
.example img,
dd img { max-width: 100%; display: block; margin: 1em auto; }
div.figure table {
margin:auto;
}
</style>
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<script defer=defer
src="http://test.csswg.org/harness/annotate.js#CSS3-WRITING-MODES_DEV"
type="text/javascript"></script>
<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 Writing Modes Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 17 June 2013</h2>
<dl>
<dt>This version:
<dd><a
href="http://dev.w3.org/csswg/css3-writing-modes/">http://dev.w3.org/csswg/css3-writing-modes/</a>
<!--
<dd><a href="http://www.w3.org/TR/2013/WD-css3-writing-modes-20130617/">http://dev.w3.org/csswg/css3-writing-modes/</a>
-->
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-writing-modes/">http://www.w3.org/TR/css3-writing-modes/</a>
<dt>Latest editor's draft:
<dd><a
href="http://dev.w3.org/csswg/css3-writing-modes/">http://dev.w3.org/csswg/css3-writing-modes/</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2012/WD-css3-writing-modes-20120501/">http://www.w3.org/TR/2012/WD-css3-writing-modes-20120501/</a>
<dt>Issues List:
<dd><a
href="http://www.w3.org/Style/CSS/Tracker/products/30">http://www.w3.org/Style/CSS/Tracker/products/30</a>
<dt>Feedback:
<dd><a
href="mailto:www-style@w3.org?subject=%5Bcss-writing-modes%5D%20feedback">www-style@w3.org</a>
with subject line “<kbd>[css-writing-modes <var>… message topic
…</var></kbd>” (<a
href="http://lists.w3.org/Archives/Public/www-style/"
rel=discussion>archives</a>)
<dt>Editors:
<dd><a href="http://fantasai.inkedblade.net/contact">Elika J. Etemad</a>
(Mozilla)
<dd><a href="mailto:koji.a.ishii@mail.rakuten.com">Koji Ishii</a>
(Rakuten, Inc.)
<dt>Previous Editors:
<dd><a href="mailto:murakami@antenna.co.jp">Shinyu Murakami</a> (<a
href="http://www.antenna.co.jp/">Antenna House</a>)
<dd><a href="mailto:paulnel@microsoft.com">Paul Nelson</a> (<a
href="http://www.microsoft.com/">Microsoft</a>)
<dd><a href="mailto:michelsu@microsoft.com">Michel Suignard</a> (<a
href="http://www.microsoft.com/">Microsoft</a>)
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><abbr
title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
href="http://www.ercim.eu/"><abbr
title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>, <a
href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use
6D50
</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract> Abstract</h2>
<p>CSS Writing Modes Level 3 defines CSS support for various international
writing modes, such as left-to-right (e.g. Latin or Indic), right-to-left
(e.g. Hebrew or Arabic), bidirectional (e.g. mixed Latin and Arabic) and
vertical (e.g. Asian scripts).
<p>Inherently bottom-to-top scripts are not handled in this version. See <a
href="#UTN22" rel=biblioentry>[UTN22]<!--{{UTN22}}--></a> for an
explanation of relevant issues.
<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-writing-modes%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-writing-modes” in the subject, preferably like this:
“[<!---->css3-writing-modes<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a
href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
the <a href="http://www.w3.org/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
2004 W3C Patent Policy</a>. W3C maintains a <a
href="http://www.w3.org/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</a>.</p>
<!--end-status-->
<p>The following features are at-risk and may be dropped during CR:
<ul>
<li>The ‘<a href="#use-glyph-orientation"><code
class=css>use-glyph-orientation</code></a>’ of ‘<a
href="#text-orientation0"><code
class=property>text-orientation</code></a>’
<li>The ‘<code class=css>digits</code>’ value of ‘<a
href="#text-combine-horizontal0"><code
class=property>text-combine-horizontal</code></a>’.
</ul>
<h2 class="no-num no-toc" id=Contents> Table of Contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#text-flow"><span class=secno>1. </span> Introduction to
Writing Modes</a>
<ul class=toc>
<li><a href="#placement"><span class=secno>1.1. </span> Module
Interactions</a>
<li><a href="#values"><span class=secno>1.2. </span> Values</a>
</ul>
<li><a href="#text-direction"><span class=secno>2. </span> Inline
Direction and Bidirectionality</a>
<ul class=toc>
<li><a href="#direction"><span class=secno>2.1. </span> Specifying
Directionality: the ‘<code class=property>direction</code>’
property</a>
<li><a href="#unicode-bidi"><span class=secno>2.2. </span> Embeddings
and Overrides: the ‘<code class=property>unicode-bidi</code>’
property</a>
<li><a href="#bidi-example"><span class=secno>2.3. </span> Example of
Bidirectional Text</a>
<li><a href="#bidi-box-model"><span class=secno>2.4. </span> Box model
for inline elements in bidirectional context</a>
</ul>
<li><a href="#vertical-intro"><span class=secno>3. </span> Introduction to
Vertical Text</a>
<ul class=toc>
<li><a href="#writing-mode"><span class=secno>3.1. </span> Block Flow
Direction: the ‘<code class=property>writing-mode</code>’
property</a>
<ul class=toc>
<li><a href="#svg-writing-mode"><span class=secno>3.1.1. </span>
SVG1.1 ‘<code class=property>writing-mode</code>’ Values</a>
</ul>
</ul>
<li><a href="#inline-alignment"><span class=secno>4. </span> Inline-level
Alignment</a>
<ul class=toc>
<li><a href="#intro-baselines"><span class=secno>4.1. </span>
Introduction to Baselines</a>
<li><a href="#text-baselines"><span class=secno>4.2. </span> Text
Baselines</a>
<li><a href="#replaced-baselines"><span class=secno>4.3. </span> Atomic
Inline Baselines</a>
<li><a href="#baseline-alignment"><span class=secno>4.4. </span>
Baseline Alignment</a>
</ul>
<li><a href="#intro-text-layout"><span class=secno>5. </span> Introduction
to Vertical Text Layout</a>
<ul class=toc>
<li><a href="#text-orientation"><span class=secno>5.1. </span> Orienting
Text: the ‘<code class=property>text-orientation</code>’
property</a>
<ul class=toc>
<li><a href="#vertical-orientations"><span class=secno>5.1.1. </span>
Mixed Vertical Orientations</a>
<li><a href="#vertical-font-features"><span class=secno>5.1.2. </span>
Vertical Typesetting and Font Features</a>
</ul>
</ul>
<li><a href="#abstract-box"><span class=secno>6. </span> Abstract Box
Terminology</a>
<ul class=toc>
<li><a href="#abstract-dimensions"><span class=secno>6.1. </span>
Abstract Dimensions</a>
<li><a href="#logical-directions"><span class=secno>6.2. </span>
Flow-relative Directions</a>
<li><a href="#line-directions"><span class=secno>6.3. </span>
Line-relative Directions</a>
<li><a href="#logical-to-physical"><span class=secno>6.4. </span>
Abstract-to-Physical Mappings</a>
</ul>
<li><a href="#abstract-layout"><span class=secno>7. </span> Abstract Box
Layout</a>
<ul class=toc>
<li><a href="#vertical-layout"><span class=secno>7.1. </span> Principles
of Layout in Vertical Writing Modes</a>
<li><a href="#dimension-mapping"><span class=secno>7.2. </span>
Dimensional Mapping</a>
<li><a href="#orthogonal-flows"><span class=secno>7.3. </span>
Orthogonal Flows</a>
<ul class=toc>
<li><a href="#orthogonal-auto"><span class=secno>7.3.1. </span>
Auto-sizing in Orthogonal Flows</a>
<li><a href="#orthogonal-multicol"><span class=secno>7.3.2. </span>
Multi-column Layout in Orthogonal Flows</a>
<li><a href="#orthogonal-pagination"><span class=secno>7.3.3. </span>
Fragmenting Orthogonal Flows</a>
</ul>
<li><a href="#logical-direction-layout"><span class=secno>7.4. </span>
Flow-Relative Mappings</a>
<li><a href="#line-mappings"><span class=secno>7.5. </span>
Line-Relative Mappings</a>
<li><a href="#physical-only"><span class=secno>7.6. </span> Purely
Physical Mappings</a>
<li><a href="#caption-side"><span class=secno>7.7. </span> Table Caption
Mappings: the ‘<code class=property>caption-side</code>’
keywords</a>
</ul>
<li><a href="#page-direction"><span class=secno>8. </span> Page Flow: the
page progression direction</a>
<li><a href="#text-combine"><span class=secno>9. </span> Glyph
Composition</a>
<ul class=toc>
<li><a href="#text-combine-horizontal"><span class=secno>9.1. </span>
Horizontal-in-Vertical Composition: the ‘<code
class=property>text-combine-horizontal</code>’ property</a>
</ul>
<li class=no-num><a href="#changes">Changes</a>
<ul class=toc>
<li class=no-num><a href="#recent-changes"> Changes since the May 2012
CSS Writing Modes Module Level 3 <abbr
title="Working Draft">WD</abbr></a>
<li class=no-num><a href="#changes-201109"> Changes since the September
2011 CSS Writing Modes Module Level 3 <abbr
title="Working Draft">WD</abbr></a>
</ul>
<li><a href="#conformance"><span class=secno>10. </span> Conformance</a>
<ul class=toc>
<li><a href="#conventions"><span class=secno>10.1. </span> Document
Conventions</a>
<li><a href="#conformance-classes"><span class=secno>10.2. </span>
Conformance Classes</a>
<li><a href="#partial"><span class=secno>10.3. </span> Partial
Implementations</a>
<li><a href="#experimental"><span class=secno>10.4. </span> Experimental
Implementations</a>
<li><a href="#testing"><span class=secno>10.5. </span>Non-Experimental
Implementations</a>
<li><a href="#cr-exit-criteria"><span class=secno>10.6. </span> CR Exit
Criteria</a>
</ul>
<li class=no-num><a href="#acknowledgements"> Acknowledgements</a>
<li class=no-num><a href="#character-properties">Appendix A. Characters
and Properties</a>
<li class=no-num><a href="#bidi-html"> Appendix B: Bidi Rules for HTML
4</a>
<li class=no-num><a href="#script-orientations">Appendix C: Vertical
Scripts in Unicode</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="#property-index"> Property Index</a>
</ul>
<!--end-toc-->
<h2 id=text-flow><span class=secno>1. </span> Introduction to Writing Modes</h2>
<p>CSS Writing Modes Level 3 defines CSS features to support for various
international writing modes, such as left-to-right (e.g. Latin or Indic),
right-to-left (e.g. Hebrew or Arabic), bidirectional (e.g. mixed Latin and
Arabic) and vertical (e.g. Asian scripts).
<p>A <dfn id=writing-mode0>writing mode</dfn> in CSS is determined by the
‘<a href="#writing-mode1"><code
class=property>writing-mode</code></a>’, ‘<a href="#direction0"><code
class=property>direction</code></a>’, and ‘<a
href="#text-orientation0"><code
class=property>text-orientation</code></a>’ properties. It is defined
primarily in terms of its <a href="#inline-base-direction"><i>inline base
direction</i></a> and <a href="#block-flow-direction"><i>block flow
direction</i></a>:
<div class=sidebar>
<div class="figure right"> <a href="diagrams/text-flow-vectors-tb.svg"
type="image/svg+xml"> <img alt="Latin-based writing mode" class=landscape
src="diagrams/text-flow-vectors-tb.png"></a>
<p class=caption>Latin-based writing mode
</div>
<div class="figure left"> <a
href="diagrams/text-flow-vectors-lr-reverse.svg" type="image/svg+xml">
<img alt="Mongolian-based writing mode" class=landscape
src="diagrams/text-flow-vectors-lr-reverse.png"></a>
<p class=caption>Mongolian-based writing mode
</div>
<div class="figure right"> <a href="diagrams/text-flow-vectors-tb.svg"
type="image/svg+xml"> <img alt="Han-based writing mode" class=landscape
src="diagrams/text-flow-vectors-tb.png"></a> <a
href="diagrams/text-flow-vectors-rl.svg" type="image/svg+xml"> <img
alt="Han-based writing mode" class=landscape
src="diagrams/text-flow-vectors-rl.png"></a>
<p class=caption>Han-based writing mode
</div>
</div>
<p>The <dfn id=inline-base-direction>inline base direction</dfn> is the
primary direction in which content is ordered on a line and defines on
which sides the “start” and “end” of a line are. The ‘<a
href="#direction0"><code class=property>direction</code></a>’ property
specifies the inline base direction of an element and, together with the
‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ property and the inherent
directionality of any text content, determines the ordering of
inline-level content within a line.
<p>The <dfn id=block-flow-direction>block flow direction</dfn> is the
direction in which block-level boxes stack and the direction in which line
boxes stack within a block container. The ‘<a
href="#writing-mode1"><code class=property>writing-mode</code></a>’
property determines the block flow direction.
<p>A <dfn id=horizontal-writing-mode>horizontal writing mode</dfn> is one
with horizontal lines of text, i.e. a downward or upward block flow. A
<dfn id=vertical-writing-mode>vertical writing mode</dfn> is one with
vertical lines of text, i.e. a leftward or rightward block flow.
<p class=note>These terms should not be confused with <dfn
id=vertical-block-flow>vertical block flow</dfn> (which is a downward or
upward block flow) and <dfn id=horizontal-block-flow>horizontal block
flow</dfn> (which is leftward or rightward block flow). To avoid
confusion, CSS specifications avoid this latter set of terms.
<p>Writing systems typically have one or two native writing modes. Some
examples are:
<ul>
<li>Latin-based systems are typically written using a left-to-right inline
direction with a downward (top-to-bottom) block flow direction.
<li>Arabic-based systems are typically written using a right-to-left
inline direction with a downward (top-to-bottom) block flow direction.
<li>Mongolian-based systems are typically written using a top-to-bottom
inline direction with a rightward (left-to-right) block flow direction.
<li>Han-based systems are commonly written using a left-to-right inline
direction with a downward (top-to-bottom) block flow direction,
<strong>or</strong> a top-to-bottom inline direction with a leftward
(right-to-left) block flow direction. Many magazines and newspapers will
mix these two writing modes on the same page.
</ul>
<p>The ‘<a href="#text-orientation0"><code
class=property>text-orientation</code></a>’ component of the writing
mode determines the <a href="#line-orientation"><i>line
orientation</i></a>, and controls details of text layout such as the
<i>glyph orientation</i>.
<p class=note>See Unicode Technical Note #22 <a href="#UTN22"
rel=
8096
biblioentry>[UTN22]<!--{{UTN22}}--></a> (<a
href="http://fantasai.inkedblade.net/style/discuss/vertical-text/paper">HTML
version</a>) for a more in-depth introduction to writing modes and
vertical text.
<h3 id=placement><span class=secno>1.1. </span> Module Interactions</h3>
<p>This module replaces and extends the ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ and ‘<a
href="#direction0"><code class=property>direction</code></a>’ features
defined in <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
sections 8.6 and 9.10.
<h3 id=values><span class=secno>1.2. </span> Values</h3>
<p>This specification follows the <a
href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property
definition conventions</a> from <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Value types not defined in
this specification are defined in CSS Level 2 Revision 1 <a
href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Other CSS
modules may expand the definitions of these value types: for example <a
href="#CSS3COLOR" rel=biblioentry>[CSS3COLOR]<!--{{CSS3COLOR}}--></a>,
when combined with this module, expands the definition of the
<color> value type as used in this specification.
<p>In addition to the property-specific values listed in their definitions,
all properties defined in this specification also accept the <a
href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
keyword as their property value. For readability it has not been repeated
explicitly.
<h2 id=text-direction><span class=secno>2. </span><a name=bidi> Inline
Direction and Bidirectionality</a></h2>
<p>While the characters in most scripts are written from left to right,
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 id=bidirectionality0 title="bidirectionality (bidi)"><dfn
id=bidirectionality>bidirectionality</dfn></span>, or "bidi" for short.
<div class=figure>
<p><img
alt="An example of bidirectional text is a Latin name in an Arabic sentence. The sentence overall is typeset right-to-left, but the letters in the Latin word in the middle are typeset left-to-right."
src="diagrams/bidi.png">
<p class=caption>Bidirectionality
</div>
<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 ordering of
bidirectional 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.
<p>User agents that support bidirectional text must apply the Unicode
bidirectional algorithm to every sequence of inline-level boxes
uninterrupted by any block boundary or “<a
href="http://www.unicode.org/reports/tr9/#Bidirectional_Character_Types">bidi
type B</a>” <dfn id=forced-paragraph-break>forced paragraph break</dfn>.
This sequence forms the <dfn id=paragraph
title="bidi paragraph">paragraph</dfn> unit in the bidirectional
algorithm. Additionally, any such sequence forming part or all of the
contents of a <a href="#bidi-isolate"><i>bidi-isolated</i></a> inline
element also forms a <a href="#paragraph"><i>bidi paragraph</i></a>.
<p>Two CSS properties, ‘<a href="#direction0"><code
class=property>direction</code></a>’ and ‘<a
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’,
provide explicit embedding, isolation, and override controls in the CSS
layer. Because the base directionality of a text depends on the structure
and semantics of the document, the ‘<a href="#direction0"><code
class=property>direction</code></a>’ and ‘<a
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’
properties should in most cases be used only to map bidi information in
the markup to its corresponding CSS styles. <strong>If a document language
provides markup features to control bidi, authors and users should use
those features instead</strong> and not specify CSS rules to override
them.
<p>In general, the paragraph embedding level is set according to the ‘<a
href="#direction0"><code class=property>direction</code></a>’ property
of the paragraph's containing block rather than by the heuristic given in
steps P2 and P3 of the Unicode algorithm. <a href="#UAX9"
rel=biblioentry>[UAX9]<!--{{!UAX9}}--></a> When the computed ‘<a
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’ of
the paragraph's containing block is ‘<a href="#plaintext"><code
class=css>plaintext</code></a>’, however, the Unicode heuristics (rules
P2 and P3) are used instead.
<p>The HTML specifications (<a href="#HTML401"
rel=biblioentry>[HTML401]<!--{{HTML401}}--></a>, section 8.2, and <a
href="#HTML5" rel=biblioentry>[HTML5]<!--{{HTML5}}--></a>, section 10.3.5)
define bidirectionality behavior for HTML elements.
<p class=note>Because HTML UAs can turn off CSS styling, we advise HTML
authors to use the HTML ‘<code class=property>dir</code>’ attribute
and <bdo> element to ensure correct bidirectional layout in the
absence of a style sheet.
<h3 id=direction><span class=secno>2.1. </span> Specifying Directionality:
the ‘<a href="#direction0"><code class=property>direction</code></a>’
property</h3>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=direction0>direction</dfn>
<tr>
<th><a href="#values">Valu
1DDA
e</a>:
<td>ltr | rtl
<tr>
<th>Initial:
<td>ltr
<tr>
<th>Applies to:
<td>all elements
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>specified value
</table>
<p>This property specifies the inline base direction or directionality of
any bidi paragraph, embedding, isolate, or override established by the
element. (See ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’.) <!-- except plaintext --> In
addition, it informs the ordering of <a
href="http://www.w3.org/TR/CSS21/tables.html">table</a> column layout, the
direction of horizontal <a
href="http://www.w3.org/TR/CSS21/visufx.html#overflow">overflow</a>, and
the default alignment of text within a line, and other layout effects that
depend on the element's inline base direction.
<p>Values for this property have the following meanings:
<dl>
<dt><dfn id=ltr>ltr</dfn>
<dd>Left-to-right directionality.
<dt><dfn id=rtl>rtl</dfn>
<dd>Right-to-left directionality.
</dl>
<p class=note>The ‘<a href="#direction0"><code
class=property>direction</code></a>’ property has no effect on bidi
reordering when specified on inline elements whose ‘<a
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’
property's value is ‘<a href="#normal"><code
class=css>normal</code></a>’, because the element does not open an
additional level of embedding with respect to the bidirectional algorithm.
<p>The value of the ‘<a href="#direction0"><code
class=property>direction</code></a>’ property on the root element is
also propagated to the initial containing block and, together with the
‘<a href="#writing-mode1"><code
class=property>writing-mode</code></a>’ property, determines the
document's principal writing mode. (See <a
href="#principal-writing-mode">below</a>.)
<p class=note>Note that the ‘<a href="#direction0"><code
class=property>direction</code></a>’ property of the HTML BODY element
is <em>not</em> propagated to the viewport. That special behavior only
applies to the background and overflow properties.
<p class=note>The ‘<a href="#direction0"><code
class=property>direction</code></a>’ 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 <a
href="#HTML401" rel=biblioentry>[HTML401]<!--{{HTML401}}--></a>, section
11.3.2.1.
<h3 id=unicode-bidi><span class=secno>2.2. </span> Embeddings and
Overrides: the ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ property</h3>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=unicode-bidi0>unicode-bidi</dfn>
<tr>
<th><a href="#values">Value</a>:
<td>normal | embed | isolate | bidi-override | isolate-override |
plaintext
<tr>
<th>Initial:
<td>normal
<tr>
<th>Applies to:
<td>all elements, but see prose
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>specified value
</table>
<p>Normally (i.e. when ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ is ‘<a href="#normal"><code
class=css>normal</code></a>’) an inline element is transparent to the
unicode bidi algorithm; content is ordered as if the element's boundaries
were not there. Other values of the ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ property cause inline elements
to create scopes within the algorithm, and to override the intrinsic
directionality of text.
<p>The following informative table summarizes the element-internal and
element-external effects of ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’:
<table class=data>
<caption>Effect of non-‘<a href="#normal"><code
class=css>normal</code></a>’ values of ‘<a
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’ on
inline elements</caption>
<colgroup span=2></colgroup>
<colgroup span=3></colgroup>
<thead>
<tr>
<th colspan=2 rowspan=2>
<th colspan=3 scope=rowgroup><abbr
title="To surrounding contents, the element behaves as if its boundary were...">Outside</abbr>
<tr>
<th><abbr
title="a strong character of the element's 'direction'.">strong</abbr>
<th><abbr title="a neutral character.">neutral</abbr>
<tbody>
<tr>
<th rowspan=3 scope=colgroup><abbr
title="Within the element, content is ordered as if...">Inside</abbr>
<th><abbr
title="the element's boundaries were strong characters of the element's 'direction'.">scoped</abbr>
<td>‘<a href="#embed"><code class=css>embed</code></a>’
<td>‘<a href="#isolate"><code class=css>isolate</code></a>’
<tr>
<th><abbr
title="all text consisted of strong characters of the element's 'direction'.">override</abbr>
<td>‘<a href="#bidi-override"><code
class=css>bidi-override</code></a>’
<td>‘<a href="#isolate-override"><code
class=css>isolate-override</code></a>’
<tr>
<th><abbr
title="the element were a standalone paragraph ordered using UAX9 heuristics.">plaintext
</abbr>
<td>—
<td>‘<a href="#plaintext"><code class=css>plaintext</code></a>’
</table>
<p>Values for this property have the following (normative) meanings:
<dl>
<dt><dfn id=normal>normal</dfn>
<dd>The element does not open an additional level of embedding with
respect to the bidirectional algorithm. For inline elements, implicit
reordering works across element boundaries.
<dt><dfn id=embed>embed</dfn>
<dd>If the element is inline, this value creates a <dfn
id=directional-embedding>directional embedding</dfn> by opening an
additional level of embedding with respect to the bidirectional
algorithm. The direction of this embedding level is given by the ‘<a
href="#direction0"><code class=property>direction</code></a>’ property.
Inside the element, reordering is done implicitly. This corresponds to
adding a LRE (U+202A), for ‘<code class=css>direction: ltr</code>’,
or RLE (U+202B), for ‘<code class=css>direction: rtl</code>’, at the
start of the element and a PDF (U+202C) at the end of the element. <span
class=note>This value has no effect on elements that are not
inline.</span>
<dt><dfn id=isolate>isolate</dfn>
<dd>On an inline element, this <dfn id=bidi-isolate
title="bidi-isolate|bidi isolation|isolation">bidi-isolates</dfn> its
contents. This is similar to a directional embedding (and increases the
embedding level accordingly) except that each sequence of inline-level
boxes uninterrupted by any block boundary or <a
href="#forced-paragraph-break"><i>forced paragraph break</i></a> is
treated as an <dfn id=isolated-sequence->isolated sequence<dfn id=x>:
</dfn></dfn>
<ul>
<li>the content within the sequence is ordered as if inside an
independent paragraph with the base directionality specified by the
element's ‘<a href="#direction0"><code
class=property>direction</code></a>’ property.
<li>for the purpose of bidi resolution in its containing bidi paragraph,
the sequence is treated as if it were a single Object Replacement
Character (U+FFFC).
</ul>
In effect, neither is the content inside the element bidi-affected by the
content surrounding the element, nor is the content surrounding the
element bidi-affected by the content or specified directionality of the
element. However, <a href="#forced-paragraph-break"><i>forced paragraph
breaks</i></a> within the element still create a corresponding break in
the containing paragraph.
<p class=note>In Unicode 6.3 and beyond, this will correspond to adding
an LRI (U+2066), for ‘<code class=css>direction: ltr</code>’, or RLI
(U+2067), for ‘<code class=css>direction: rtl</code>’, at the start
of the element, and a PDI (U+2069) at the end of the element.
<p class=note>This value has no effect on elements that are not inline.
<dt><dfn id=bidi-override>bidi-override</dfn>
<dd>This value puts the element's immediate content in a <dfn
id=directional-override>directional override</dfn>. For an inline, this
means that the element acts like a <a
href="#directional-embedding"><i>directional embedding</i></a> in the
bidirectional algorithm, except that reordering within it is strictly in
sequence according to the ‘<a href="#direction0"><code
class=property>direction</code></a>’ property; the implicit part of the
bidirectional algorithm is ignored. This corresponds to adding a LRO
(U+202D), for ‘<code class=css>direction: ltr</code>’, or RLO
(U+202E), for ‘<code class=css>direction: rtl</code>’, at the start
of the element and a PDF (U+202C) at the end of the element. If the
element is a block container, the override is applied to an anonymous
inline element that surrounds all of its content.
<dt><dfn id=isolate-override>isolate-override<dfn id=x0></dfn></dfn>
<dd>This combines the <a href="#bidi-isolate"><i>isolation</i></a>
behavior of ‘<a href="#isolate"><code class=css>isolate</code></a>’
with the <i>override</i> behavior of ‘<a href="#bidi-override"><code
class=css>bidi-override</code></a>’: to surrounding content, it is
equivalent to ‘<a href="#isolate"><code
class=css>isolate</code></a>’, but within the element content is
ordered as if ‘<a href="#bidi-override"><code
class=css>bidi-override</code></a>’ were specified.
<dt><dfn id=plaintext>plaintext</dfn>
<dd>
<p>This value behaves as ‘<a href="#isolate"><code
class=css>isolate</code></a>’ except that for the purposes of the
Unicode bidirectional algorithm, the base directionality of each of the
element's <a href="#paragraph"><i>bidi paragraphs</i></a> (if a block
container) or <a href="#isolated-sequence-"><i>isolated
sequences</i></a> (if an inline) is determined by following the
heuristic in rules P2 and P3 of the Unicode bidirectional algorithm
(rather than by using the ‘<a href="#direction0"><code
class=property>direction</code></a>’ property of the element).
<p class=note>In Unicode 6.3 and beyond, for inline elements this will
correspond to adding an FSI (U+2068) at the start of the element, and a
PDI (U+2069) at the end of the element.
</dl>
<p class=note>Because the ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ property does not inherit,
setting ‘<a href="#bidi-override"><code
class=css>bidi-override</code></a>’ or ‘<a href="#plaintext"><code
class=css>plaintext</code></a>’ on a block element will not affect any
descendant blocks. Therefore these values are best used on blocks and
inlines that do not contain any block-level structures.
<p class=note>Note that ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ does not affect the ‘<a
href="#direction0"><code class=property>direction</code></a>’ property
even in the case of ‘<a href="#plaintext"><code
class=css>plaintext</code></a>’, and thus does not affect ‘<a
href="#direction0"><code class=property>direction</code></a>’-dependent
layout calculations.
<p>The final order of characters within each <a href="#paragraph"><i>bidi
paragraph</i></a> 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.
<p>In this process, replaced elements with ‘<code class=css>display:
inline</code>’ are treated as neutral characters, unless their ‘<a
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’
property is either ‘<a href="#embed"><code
class=property>embed</code></a>’ or ‘<a href="#bidi-override"><code
class=property>bidi-override</code></a>’, in which case they are treated
as strong characters in the ‘<a href="#direction0"><code
class=property>direction</code></a>’ specified for the element. All
other atomic inline-level boxes are treated as neutral characters always.
<p>If an inline element is broken around a <a href="#paragraph"><i>bidi
paragraph</i></a> boundary (e.g. if split by a block or <a
href="#forced-paragraph-break"><i>forced paragraph break</i></a>), then
the bidi control codes assigned to the end of the element are added before
the interruption and the codes assigned to the start of the element are
added after it. (In other words, any embedding levels or overrides started
by the element are closed at the paragraph break and reopened on the other
side of it.)
<div class=example>
<p>For example, where <BR/> is a <a
href="#forced-paragraph-break"><i>forced paragraph break</i></a> the bidi
ordering is identical between
<pre><para>...<i1><i2>...<BR/>...</i2><i1>...</para></pre>
<p>and
<pre><para>...<i1><i2>...</i2><i1><BR/><i1><i2>...</i2><i1>...</para></pre>
<p>for all values of ‘<a href="#unicode-bidi0"><code
class=property>unicode-bidi</code></a>’ on inline elements <i1>
and <i2>.
</div>
<p class=note> Because the Unicode algorithm has a limit of 61 levels of
embedding, care should be taken not to use ‘<a
href="#unicode-bidi0"><code class=property>unicode-bidi</code></a>’ with
a value other than ‘<a href="#normal"><code
class=property>normal</code></a>’ unless appropriate. In particular, a
value of ‘<code class=css>inherit</code>’ should be used with extreme
caution. However, for elements that are, in general, intended to be
displayed as blocks, a setting of ‘<code class=css>unicode-bidi:
isolate</code>’ is preferred to keep the element together in case the
‘<code class=property>display</code>’ is changed to ‘<code
class=css>inline</code>’ (see example below).
<h3 id=bidi-example><span class=secno>2.3. </span> Example of Bidirectional
Text</h3>
<p>The following example shows an SGML document with bidirectional text. It
illustrates an important design principle: document language 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, and
such rules should not be overridden by other style sheets so that the
document language's bidi behavior is preserved.
<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.
<pre class=xml-example><code class=xml>
<section dir=rtl>
<para>HEBREW1 HEBREW2 english3 HEBREW4 HEBREW5</para>
<para>HEBREW6 <emphasis>HEBREW7</emphasis> HEBREW8</para>
</section>
<section dir=ltr>
<para>english9 english10 english11 HEBREW12 HEBREW13</para>
<para>english14 english15 english16</para>
<para>english17 <quote dir=rtl>HEBREW18 english19 HEBREW20</quote></para>
</section>
</code></pre>
<p>Since this is arbitrary SGML, the style sheet is responsible for
setting the writing direction. This is the style sheet:
<pre>
/* Rules for bidi */
[dir=ltr] {direction: rtl;}
[dir=rtl] {direction: ltr;}