-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
4426 lines (3302 loc) · 151 KB
/
Overview.html
File metadata and controls
4426 lines (3302 loc) · 151 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
<
9927
div data-line-number="469" class="react-line-number react-code-text" style="padding-right:16px">469470
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
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 Text 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 Text Module Level 3" name=dcterms.title>
<meta content=text name=dcterms.type>
<meta content=2013-11-12 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://www.w3.org/TR/2013/WD-css-text-3-20131112/"
name=dcterms.identifier>
<link href="#contents" rel=contents><!--<link rel=index href="#index">-->
<link href="../default.css" rel=stylesheet type="text/css">
<style type="text/css">
.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 }
/* Start Letter-spacing Tutorial */
.ls-ex {
font-size: 200%;
margin-left: 1em;
margin-right: 1em;
}
.ls-fixed-width {
width: 10em;
}
.color-box { background: rgb(224, 203, 82); }
.bad { color: red; }
.good { color: green; }
/* End Letter-spacing Tutorial */
.char { border: 1px dotted gray; }
.quarter { font-size: 25%; }
tt[lang="ja"] { font-family: "MS Gothic", "Osaka", monospace }
div.figure table {
margin :auto;
}
.feedback {
background: #FFEECC;
border-color: orange;
}
.feedback:before {
content: "Info Needed";
color: #FF8800;
}
</style>
<link href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" rel=stylesheet
type="text/css">
<script defer=defer
src="http://test.csswg.org/harness/annotate.js#css-text-3_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 Text Module Level 3</h1>
<h2 class="no-num no-toc">W3C Working Draft 12 November 2013</h2>
<dl>
<dt>This version:
<dd><a
href="http://www.w3.org/TR/2013/WD-css-text-3-20131112/">http://www.w3.org/TR/2013/WD-css-text-3-20131112/</a></dd>
<!--
<dd><a href="http://dev.w3.org/csswg/css3-text/">http://dev.w3.org/csswg/css3-text/</a>
-->
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css-text-3/">http://www.w3.org/TR/css-text-3/</a>
<dt>Latest editor's draft:
<dd><a
href="http://dev.w3.org/csswg/css-text-3/">http://dev.w3.org/csswg/css-text-3/</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2012/WD-css3-text-20121113/">http://www.w3.org/TR/2012/WD-css3-text-20121113/</a>
<dt>Issues List:
<dd><a
href="http://www.w3.org/Style/CSS/Tracker/products/10">http://www.w3.org/Style/CSS/Tracker/products/10</a>
<dt>Feedback:
<dd><a
href="mailto:www-style@w3.org?subject=%5Bcss-text%5D%20feedback">www-style@w3.org</a>
with subject line “<kbd>[css-text] <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>Test Suite:
<dd><a
href="http://test.csswg.org/suites/css3-text/nightly-unstable/">http://test.csswg.org/suites/css3-text/nightly-unstable/</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</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>This CSS3 module defines properties for text manipulation and specifies
their processing model. It covers line breaking, justification and
alignment, white space handling, and text transformation.
<h2 class="no-num no-toc" id=status>Status of This Document</h2>
<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>Publication as a Last Call Working Draft does not imply endorsement by
the W3C Membership. This is a draft document and may be updated, replaced
or obsoleted by other documents at any time. It is inappropriate to cite
this document as other than work in progress.
<p>This CSS module has been produced as a combined effort of the <a
href="http://www.w3.org/International/Activity">W3C Internationalization
Activity</a>, and the <a href="http://www.w3.org/Style/Activity">Style
Activity</a> and is maintained by the <a
href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>. It also
includes contributions made by participants in the <a
href="http://www.w3.org/Style/XSL/Group/">XSL Working Group</a> (<a
href="http://cgi.w3.org/MemberAccess/AccessRequest">members only</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>The following features are at risk and may be cut from the spec during
its CR period if there are no (correct) implementations:
<ul>
<li>the ‘<code class=css>full-width</code>’ value of ‘<a
href="#text-transform"><code class=property>text-transform</code></a>’
<li>the <length> values of the ‘<a href="#tab-size"><code
class=property>tab-size</code></a>’ property
<li>the ‘<code class=css>start end</code>’ value of ‘<a
href="#text-align"><code class=property>text-align</code></a>
A0B2
<li>the ‘<a href="#text-justify"><code
class=property>text-justify</code></a>’ property
<li>the percentage values of ‘<a href="#word-spacing"><code
class=property>word-spacing</code></a>’
<li>the ‘<a href="#hanging-punctuation"><code
class=property>hanging-punctuation</code></a>’ property
</ul>
<p>This specification is a <strong>Last Call Working Draft</strong>. All
persons are encouraged to review this document and <strong>send comments
to the <a
href="http://lists.w3.org/Archives/Public/www-style/">www-style</a>
mailing list</strong> as described below. The <strong>deadline for
comments</strong> is <strong>7 November 2013</strong>.
<p><strong>Feedback on this draft should be posted to the (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org">www-style@w3.org</a></strong> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) <strong>with
<kbd>[css-text]</kbd> in the subject line.</strong> You are strongly
encouraged to complain if you see something stupid in this draft. The
editors will do their best to respond to all feedback.
<h2 class="no-num no-toc" id=contents> Table of Contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#intro"><span class=secno>1. </span> Introduction</a>
<ul class=toc>
<li><a href="#placement"><span class=secno>1.1. </span> Module
Interactions</a>
<li><a href="#values"><span class=secno>1.2. </span> Values</a>
<li><a href="#terms"><span class=secno>1.3. </span> Terminology</a>
</ul>
<li><a href="#transforming"><span class=secno>2. </span> Transforming
Text</a>
<ul class=toc>
<li><a href="#text-transform-property"><span class=secno>2.1. </span>
Case Transforms: the ‘<code class=property>text-transform</code>’
property</a>
</ul>
<li><a href="#white-space-property"><span class=secno>3. </span> White
Space and Wrapping: the ‘<code class=property>white-space</code>’
property</a>
<li><a href="#white-space-processing"><span class=secno>4. </span> White
Space Processing Details</a>
<ul class=toc>
<li><a href="#white-space-rules"><span class=secno>4.1. </span> The
White Space Processing Rules</a>
<ul class=toc>
<li><a href="#white-space-phase-1"><span class=secno>4.1.1.
</span>Phase I: Collapsing and Transformation</a>
<li><a href="#line-break-transform"><span class=secno>4.1.2. </span>
Segment Break Transformation Rules</a>
<li><a href="#white-space-phase-2"><span class=secno>4.1.3.
</span>Phase II: Trimming and Positioning</a>
</ul>
<li><a href="#tab-size-property"><span class=secno>4.2. </span> Tab
Character Size: the ‘<code class=property>tab-size</code>’
property</a>
</ul>
<li><a href="#line-breaking"><span class=secno>5. </span> Line Breaking
and Word Boundaries</a>
<ul class=toc>
<li><a href="#line-break-details"><span class=secno>5.1. </span> Line
Breaking Details</a>
<li><a href="#line-break-property"><span class=secno>5.2. </span>
Breaking Rules for Punctuation: the ‘<code
class=property>line-break</code>’ property</a>
<li><a href="#word-break-property"><span class=secno>5.3. </span>
Breaking Rules for Letters: the ‘<code
class=property>word-break</code>’ property</a>
</ul>
<li><a href="#hyphenation"><span class=secno>6. </span>Breaking Within
Words</a>
<ul class=toc>
<li><a href="#hyphens-property"><span class=secno>6.1.
</span>Hyphenation Control: the ‘<code
class=property>hyphens</code>’ property</a>
<li><a href="#overflow-wrap-property"><span class=secno>6.2. </span>
Overflow Wrapping: the ‘<code
class=property>overflow-wrap</code>’/‘<code
class=property>word-wrap</code>’ property</a>
</ul>
<li><a href="#justification"><span class=secno>7. </span> Alignment and
Justification</a>
<ul class=toc>
<li><a href="#text-align-property"><span class=secno>7.1. </span> Text
Alignment: the ‘<code class=property>text-align</code>’
property</a>
<li><a href="#text-align-last-property"><span class=secno>7.2. </span>
Last Line Alignment: the ‘<code
class=property>text-align-last</code>’ property</a>
<li><a href="#text-justify-property"><span class=secno>7.3. </span>
Justification Method: the ‘<code
class=property>text-justify</code>’ property</a>
<ul class=toc>
<li><a href="#expanding-text"><span class=secno>7.3.1. </span>
Expanding and Compressing Text</a>
<li><a href="#justify-symbols"><span class=secno>7.3.2. </span>
Handling Symbols and Punctuation</a>
<li><a href="#justify-limits"><span class=secno>7.3.3. </span>
Unexpandable Text</a>
<li><a href="#justify-cursive"><span class=secno>7.3.4. </span>
Cursive Scripts</a>
<li><a href="#justify-algos"><span class=secno>7.3.5. </span> Possible
Algorithms</a>
</ul>
</ul>
<li><a href="#spacing"><span class=secno>8. </span> Spacing</a>
<ul class=toc>
<li><a href="#word-spacing-property"><span class=secno>8.1. </span> Word
Spacing: the ‘<code class=property>word-spacing</code>’
property</a>
<li><a href="#letter-spacing-property"><span class=secno>8.2. </span>
Tracking: the ‘<code class=property>letter-spacing</code>’
property</a>
</ul>
<li><a href="#edge-effects"><span class=secno>9. </span> Edge Effects</a>
<ul class=toc>
<li><a href="#text-indent-property"><span class=secno>9.1. </span> First
Line Indentation: the ‘<code class=property>text-indent</code>’
property</a>
<li><a href="#hanging-punctuation-property"><span class=secno>9.2.
</span> Hanging Punctuation: the ‘<code
class=property>hanging-punctuation</code>’ property</a>
<li><a href="#bidi-linebox"><span class=secno>9.3. </span>
Bidirectionality and Line Boxes</a>
</ul>
<li class=no-num><a href="#order">Appendix A: Text Processing Order of
Operations</a>
<li class=no-num><a href="#default-stylesheet"> Appendix B: Default UA
Stylesheet</a>
<li class=no-num><a href="#script-groups"> Appendix C: Cursive Scripts</a>
<li class=no-num><a href="#acknowledgements"> Acknowledgements</a>
<li class=no-num><a href="#changes"> Changes</a>
<ul class=toc>
<li class=no-num><a href="#recent-changes"> Changes from the November
2012 CSS3 Text <abbr title="Working Draft">WD</abbr></a>
</ul>
<li class=no-num><a href="#conformance"> Conformance</a>
<ul class=toc>
<li class=no-num><a href="#conventions"> Document Conventions</a>
<li class=no-num><a href="#conformance-classes"> Conformance Classes</a>
<li class=no-num><a href="#partial"> Partial Implementations</a>
<li class=no-num><a href="#experimental"> Experimental
Implementations</a>
<li class=no-num><a href="#testing"> Non-Experimental
Implementations</a>
<li class=no-num><a href="#cr-exit-criteria"> CR Exit Criteria</a>
</ul>
<li class=no-num><a href="#references"> References</a>
<ul class=toc>
<li class=no-num><a href="#normative-ref"> Normative references</a>
<li class=no-num><a href="#informative-ref"> Informative references</a>
</ul>
<li class=no-num><a href="#index"> Index</a>
<li class=no-num><a href="#property-index"> Property Index</a>
</ul>
<!--end-toc-->
<h2 id=intro><span class=secno>1. </span> Introduction</h2>
<p>This module describes the typesetting controls of CSS; that is, the
features of CSS that control the translation of source text to formatted,
line-wrapped text. Various CSS properties provide control over <a
href="#transforming">case transformation</a>, <a href="#white-space">white
space collapsing</a>, <a href="#white-space">text wrapping</a>, <a
href="#line-breaking">line breaking rules</a> and <a
href="#hyphenation">hyphenation</a>, <a href="#justification">alignment
and justification</a>, <a href="#spacing">spacing</a>, and <a
href="#edge-effects">indentation</a>.
<div class=note>
<p>Font selection is covered in <a
href="http://www.w3.org/TR/css3-fonts/">CSS Fonts Level 3</a> <a
href="#ref-CSS3-FONTS"
rel=biblioentry>[CSS3-FONTS]<!--{{CSS3-FONTS}}--></a>.
<p> <a name=decoration></a> <a name=text-decoration></a> <a
name=line-decoration></a> <a name=text-decoration-line></a> <a
name=text-decoration-color></a> <a name=text-decoration-style></a> <a
name=text-decoration-skip></a> <a name=text-underline-position></a> <a
name=emphasis-marks></a> <a name=text-emphasis-style></a> <a
name=text-emphasis-color></a> <a name=text-emphasis></a> <a
name=text-emphasis-position></a> <a name=text-shadow></a> Features for
decorating text, such as <a
href="http://www.w3.org/TR/css-text-decor-3/#line-decoration">underlines</a>,
<a href="http://www.w3.org/TR/css-text-decor-3/#emphasis-marks">emphasis
marks</a>, and <a
href="http://www.w3.org/TR/css-text-decor-3/#text-shadow-property">shadows</a>,
(previously part of this module) are covered in <a
href="http://www.w3.org/TR/css-text-decor-3/">CSS Text Decoration Level
3</a> <a href="#ref-CSS3-TEXT-DECOR"
rel=biblioentry>[CSS3-TEXT-DECOR]<!--{{CSS3-TEXT-DECOR}}--></a>.
<p><a
href="
A835
http://www.w3.org/TR/css3-writing-modes/#text-direction">Bidirectional</a>
and <a
href="http://www.w3.org/TR/css3-writing-modes/#vertical-intro">vertical</a>
text are addressed in <a
href="http://www.w3.org/TR/css3-writing-modes/">CSS Writing Modes Level
3</a> <a href="#ref-CSS3-WRITING-MODES"
rel=biblioentry>[CSS3-WRITING-MODES]<!--{{CSS3-WRITING-MODES}}--></a>.
</div>
<h3 id=placement><span class=secno>1.1. </span> Module Interactions</h3>
<p>This module, together with <a href="#ref-CSS3-TEXT-DECOR"
rel=biblioentry>[CSS3-TEXT-DECOR]<!--{{CSS3-TEXT-DECOR}}--></a>, replaces
and extends the text-level features defined in <a href="#ref-CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> chapter 16.
<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="#ref-CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Value types not defined in
this specification are defined in CSS Level 2 Revision 1 <a
href="#ref-CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Other CSS
modules may expand the definitions of these value types: for example <a
href="#ref-CSS3VAL" rel=biblioentry>[CSS3VAL]<!--{{CSS3VAL}}--></a>, when
combined with this module, expands the definition of the
<var><length></var> 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.
<h3 id=terms><span class=secno>1.3. </span> Terminology</h3>
<p id=grapheme-cluster>A <dfn id=grapheme-cluster0>grapheme cluster</dfn>
is what a language user considers to be a character or a basic unit of the
script. The term is described in detail in the Unicode Technical Report:
Text Boundaries <a href="#ref-UAX29"
rel=biblioentry>[UAX29]<!--{{!UAX29}}--></a>. This specification uses the
<em>extended grapheme cluster</em> definition in <a href="#ref-UAX29"
rel=biblioentry>[UAX29]<!--{{!UAX29}}--></a> (not the <em>legacy grapheme
cluster</em> definition). The UA may further tailor the definition as
required by typographical tradition.
<div class=example>
<p>For example, to properly letter-space the Thai word คำ (U+0E04 +
U+0E33), the U+0E33 needs to be decomposed into U+0E4D + U+0E32, and then
the extra letter-space inserted before the U+0E32: คํ า.
<p>A slightly more complex example is น้ำ (U+0E19 + U+0E49 +
U+0E33). In this case, normal Thai shaping will first decompose the
U+0E33 into U+0E4D + U+0E32 and then swap the U+0E4D with the U+0E49,
giving U+0E19 + U+0E4D + U+0E49 + U+0E32. As before the extra
letter-space is then inserted before the U+0E32: นํ้ า.
</div>
<p>Within this specification, the ambiguous term <dfn
id=character>character</dfn> is used as a friendlier synonym for <a
href="#grapheme-cluster0"><i>grapheme cluster</i></a>. See <a
href="http://www.w3.org/TR/css3-writing-modes/#character-properties">Characters
and Properties</a> for how to determine the Unicode properties of a
character.
<p id=letter>A <dfn id=letter0>letter</dfn> for the purpose of this
specification is a <a href="#character"><i>character</i></a> belonging to
one of the Letter or Number general categories in Unicode. <a
href="#ref-UAX44" rel=biblioentry>[UAX44]<!--{{!UAX44}}--></a>
<p>The rendering characteristics of a <a
href="#character"><i>character</i></a> divided by an element boundary is
undefined: it may be rendered as belonging to either side of the boundary,
or as some approximation of belonging to both. Authors are forewarned that
dividing grapheme clusters by element boundaries may give inconsistent or
undesired results.
<p>The <dfn id=content-language>content language</dfn> of an element is the
(human) language the element is declared to be in, according to the rules
of the <a
href="http://www.w3.org/TR/CSS21/conform.html#doclanguage">document
language</a>. For example, the rules for determining the <a
href="#content-language"><i>content language</i></a> of an HTML element
use the <code>lang</code> attribute and are defined in <a
href="#ref-HTML5" rel=biblioentry>[HTML5]<!--{{HTML5}}--></a>, and the
rules for determining the <a href="#content-language"><i>content
language</i></a> of an XML element use the <code>xml:lang</code> attribute
and are <a href="http://www.w3.org/TR/REC-xml/#sec-lang-tag">defined</a>
in <a href="#ref-XML10" rel=biblioentry>[XML10]<!--{{XML10}}--></a>. Note
that it is possible for the <a href="#content-language"><i>content
language</i></a> of an element to be unknown.
<p>Other terminology and concepts used in this specification are defined in
<a href="#ref-CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> and <a
href="#ref-CSS3-WRITING-MODES"
rel=biblioentry>[CSS3-WRITING-MODES]<!--{{!CSS3-WRITING-MODES}}--></a>.
<h2 id=transforming><span class=secno>2. </span> Transforming Text</h2>
<h3 id=text-transform-property><span class=secno>2.1. </span> <a
name=caps-prop></a> Case Transforms: the ‘<a
href="#text-transform"><code class=property>text-transform</code></a>’
property</h3>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=text-transform>text-transform</dfn>
<tr>
<th><a href="#values">Value</a>:
<td>none | capitalize | uppercase | lowercase | full-width
<tr>
<th>Initial:
<td>none
<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>as specified
<tr>
<th>Animatable:
<td>no
<tr>
<th>Canonical order:
<td>N/A
</table>
<p>This property transforms text for styling purposes. (It has no effect on
the underlying content.) Values have the following meanings:
<dl>
<dt><dfn id=none title="none!!text-transform">‘<code
class=css>none</code>’</dfn>
<dd>No effects.
<dt><dfn id=capitalize title="capitalize!!text-transform">‘<code
class=css>capitalize</code>’</dfn>
<dd>Puts the first <a href="#letter0"><i>letter</i></a> of each word in
titlecase; other characters are unaffected.
<dt><dfn id=uppercase title="uppercase!!text-transform">‘<code
class=css>uppercase</code>’</dfn>
<dd>Puts all <a href="#letter0"><i>letters</i></a> in uppercase.
<dt><dfn id=lowercase title="lowercase!!text-transform">‘<code
class=css>lowercase</code>’</dfn>
<dd>Puts all <a href="#letter0"><i>letters</i></a> in lowercase.
<dt><dfn id=full-width title="full-width!!text-transform">‘<code
class=css>full-width</code>’</dfn>
<dd>Puts all characters in fullwidth form. If the character does not have
a corresponding fullwidth form, it is left as is. This value is typically
used to typeset Latin characters and digits like ideographic characters.
</dl>
<p>The definition of “word“ used for ‘<code
class=css>capitalize</code>’ is UA-dependent; <a href="#ref-UAX29"
rel=biblioentry>[UAX29]<!--{{!UAX29}}--></a> is suggested (but not
required) for determining such word boundaries. Authors should not expect
‘<code class=css>capitalize</code>’ to follow language-specific
titlecasing conventions (such as skipping articles in English).
<div class=example>
<p>The following example converts the ASCII characters used in
abbreviations in Japanese text to their fullwidth variants so that they
lay out and line break like ideographs:
<pre>abbr:lang(ja) { text-transform: full-width; }</pre>
</div>
<p>The case mapping rules for the character repertoire specified by the
Unicode Standard can be found on the Unicode Consortium Web site <a
href="#ref-UNICODE" rel=biblioentry>[UNICODE]<!--{{!UNICODE}}--></a>. The
UA must use the full case mappings for Unicode characters, including any
conditional casing rules, as defined in Default Case Algorithm section. If
(and only if) the <a href="#content-language"><i>content language</i></a>
of the element is, according to the rules of the <a
href="http://www.w3.org/TR/CSS21/conform.html#doclanguage">document
language</a>, known, then any appropriate language-specific rules must be
applied as well. These minimally include, but are not limited to, the
language-specific rules in Unicode's <a
href="http://www.unicode.org/Public/UNIDATA/SpecialCasing.txt">SpecialCasing.txt</a>.
<div class=example>
<p>For example, in Turkish there are two “i”s, one with a
dot—“İ” and “i”— and one without—“I” and “ı”.
Thus the usual case mappings between “I” and “i” are replaced
with a different set of mappings to their respective undotted/dotted
counterparts, which do not exist in English. This mapping must only take
effect if the <a href="#content-language"><i>content language</i></a> is
Turkish (or another Turkic language that uses Turkish casing rules); in
other languages, the usual mapping of “I” and “i” is required.
This rule is thus conditionally defined in Unicode's SpecialCasing.txt
file.
</div>
<p>The definition of fullwidth and halfwidth forms can be found on the
Unicode consortium web site at <a href="#ref-UAX11"
rel=biblioentry>[UAX11]<!--{{!UAX11}}--></a>. The mapping to fullwidth
form is defined by taking code points with the <code><wide></code>
or the <code><narrow></code> tag in their
<code>Decomposition_Mapping</code> in <a href="#ref-UAX44"
rel=biblioentry>[UAX44]<!--{{!UAX44}}--></a>. For the
<code><narrow></code> tag, the mapping is from the code point to the
decomposition (minus <code><narrow></code> tag), and for the
<code><wide></code> tag, the mapping is from the decomposition
(minus the <code><wide></code> tag) back to the original code point.
<p>Text transformation happens after <a href="#white-space-rules">white
space processing</a>, which means that ‘<code
class=css>full-width</code>’ transforms only preserved U+0020 spaces to
U+3000.
<p class=note> A future level of CSS may introduce the ability to create
custom mapping tables for less common text transforms, such as by an
‘<code class=css>@text-transform</code>’ rule similar to ‘<code
class=css>@counter-style</code>’ from <a
href="#ref-CSS-COUNTER-STYLES-3"
rel=biblioentry>[CSS-COUNTER-STYLES-3]<!--{{CSS-COUNTER-STYLES-3}}--></a>.
<h2 id=white-space-property><span class=secno>3. </span><a
id=white-space-collapsing></a><a id=text-wrap></a> White Space and
Wrapping: the ‘<a href="#white-space"><code
class=property>white-space</code></a>’ property</h2>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=white-space>white-space</dfn>
<tr>
<th><a href="#values">Value</a>:
<td>normal | pre | nowrap | pre-wrap | pre-line
<tr>
<th>Initial:
<td>normal
<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>as specified
<tr>
<th>Animatable:
<td>no
<tr>
<th>Canonical order:
<td>N/A
</table>
<p>This property specifies two things:
<ul>
<li>whether and how <a href="#white-space-processing">white space</a>
inside the element is collapsed
<li>whether lines may <a href="#wrapping"><i>wrap</i></a> at unforced <a
href="#soft-wrap-opportunity"><i>soft wrap opportunities</i></a>
</ul>
<p>Values have the following meanings, which must be interpreted according
to the <a href="#white-space-rules">White Space Processing</a> and <a
href="#line-breaking">Line Breaking</a> rules:
<dl>
<dt><dfn id=normal title="normal!!white-space">‘<code
class=css>normal</code>’</dfn>
<dd>This value directs user agents to collapse sequences of white space
into a single character (or <a href="#line-break-transform">in some
cases</a>, no character). Lines may wrap at allowed <a
href="#soft-wrap-opportunity"><i>soft wrap opportunities</i></a>, as
determined by the line-breaking rules in effect, in order to minimize
inline-axis overflow.
<dt><dfn id=pre title="pre!!white-space">‘<code
class=css>pre</code>’</dfn>
<dd>This value prevents user agents from collapsing sequences of white
space. <a href="#segment-break"><i>Segment breaks</i></a> such as line
feeds and carriage returns are preserved as <a
href="#forced-line-break"><i>forced line breaks</i></a>. Lines only break
at <a href="#forced-line-break"><i>forced line breaks</i></a>; content
that does not fit within the block container overflows it.
<dt><dfn id=nowrap title="nowrap!!white-space">‘<code
class=css>nowrap</code>’</dfn>
<dd>Like ‘<code class=css>normal</code>’, this value collapses white
space; but like ‘<code class=css>pre</code>’, it does not allow
wrapping.
<dt><dfn id=pre-wrap title="pre-wrap!!white-space">‘<code
class=css>pre-wrap</code>’</dfn>
<dd>Like ‘<code class=css>pre</code>’, this value preserves white
space; but like ‘<code class=css>normal</code>’, it allows wrapping.
<dt><dfn id=pre-line title="pre-line!!white-space">‘<code
class=css>pre-line</code>’</dfn>
<dd>Like ‘<code class=css>normal</code>’, this value collapses
consecutive spaces and allows wrapping, but preserves <a
href="#segment-break"><i>segment breaks</i></a> in the source as <a
href="#forced-line-break"><i>forced line breaks</i></a>.
</dl>
<p>The following informative table summarizes the behavior of various ‘<a
href="#white-space"><code class=property>white-space</code></a>’ values:
<table class=data>
<colgroup class=header></colgroup>
<colgroup span=3></colgroup>
<thead>
<tr>
<th>
<th>New Lines
<th>Spaces and Tabs
<th>Text Wrapping
<tbody>
<tr>
<th>‘<code class=css>normal</code>’
<td>Collapse
<td>Collapse
<td>Wrap
<tr>
<th>‘<code class=css>pre</code>’
<td>Preserve
<td>Preserve
<td>No wrap
<tr>
<th>‘<code class=css>nowrap</code>’
<td>Collapse
<td>Collapse
<td>No wrap
<tr>
<th>‘<code class=css>pre-wrap</code>’
<td>Preserve
<td>Preserve
<td>Wrap
<tr>
<th>‘<code class=css>pre-line</code>’
<td>Preserve
<td>Collapse
<td>Wrap
</table>
<p>See <a href="#white-space-processing">White Space Processing Rules</a>
for details on how white space collapses. An informative summary of
collapsing (‘<code class=css>normal</code>’ and ‘<code
class=css>nowrap</code>’) is presented below:
<ul>
<li>A sequence of segment breaks and other white space between two
Chinese, Japanese, or Yi characters collapses into nothing.
<li>A zero width space before or after a white space sequence containing a
segment break causes the entire sequence of white space to collapse into
a zero width space.
<li>Otherwise, consecutive white space collapses into a single space.
</ul>
<p>See <a href="#line-breaking">Line Breaking</a> for details on wrapping
behavior.
<h2 id=white-space-processing><span class=secno>4. </span> White Space
Processing Details</h2>
<p>The source text of a document often contains formatting that is not
relevant to the final rendering: for example, <a
href="http://rhodesmill.org/brandon/2012/one-sentence-per-line/">breaking
the source into segments</a> (lines) for ease of editing or adding white
space characters such as tabs and spaces to indent the source code. CSS
white space processing allows the author to control interpretation of such
formatting: to preserve or collapse it away when rendering the document.
White space processing in CSS interprets white space characters only for
rendering: it has no effect on the underlying document data.
<p>White space processing in CSS is controlled with the ‘<a
href="#white-space"><code class=property>white-space</code></a>’
property.
<p id=segment-normalization> CSS does not define document segmentation
rules. Segments could be separated by a particular newline seqence (such
as a line feed or CRLF pair), or delimited by some other mechanism, such
as the SGML <code>RECORD-START</code> and <code>RECORD-END</code> tokens.
For CSS processing, each document language–defined segment break, CRLF
sequence (U+000D U+000A), carriage return (U+000D), and line feed (U+000A)
in the text is treated as a <dfn id=segment-break>segment break</dfn>,
which is then interpreted for rendering as specified by the ‘<a
href="#white-space"><code class=property>white-space</code></a>’
property.
<p class=note>Note that the document parser may have not only normalized
any segment breaks, but also collapsed other space characters or otherwise
processed white space according to markup rules. Because CSS processing
occurs <em>after</em> the parsing stage, it is not possible to restore
these characters for styling. Therefore, some of the behavior specified
below can be affected by these limitations and may be user agent
dependent.
<p class=note>Note that anonymous inlines consisting entirely of <a
href="#collapsible"><i>collapsible</i></a> white space are removed from
the rendering tree. See <a href="#ref-CSS21"
rel=biblioentry>[CSS21]<!--{{CSS21}}--></a> section <a
href="http://www.w3.org/TR/CSS21/visuren.html#anonymous">9.2.2.1</a>
<p>Control characters (Unicode class Cc) other than tab (U+0009), line feed
(U+000A), and carriage return (U+000D) are ignored for the purpose of
rendering.
<h3 id=white-space-rules><span class=secno>4.1. </span> The White Space
Processing Rules</h3>
<p>White space processing affects only spaces (U+0020), tabs (U+0009), and
<a href="#segment-normalization">segment breaks</a>.
<h4 id=white-space-phase-1><span class=secno>4.1.1. </span>Phase I:
Collapsing and Transformation</h4>
<p>For each inline (including anonymous inlines) within an inline
formatting context, white space characters are handled as follows,
ignoring bidi formatting characters as if they were not there:
<ul>
<li id=collapse>
<p>If ‘<a href="#white-space"><code
class=property>white-space</code></a>’ is set to ‘<code
class=css>normal</code>’, ‘<code class=css>nowrap</code>’, or
‘<code class=css>pre-line</code>’, white space characters are
considered <dfn id=collapsible>collapsible</dfn> and are processed by
performing the following steps:
<ol>
<li>All spaces and tabs immediately preceding or following a segment
break are removed.
<li>Segment breaks are transformed for rendering according to the <a
href="#line-break-transform">segment break transformation rules</a>.
<li>Every tab is converted to a space (U+0020).
<li>Any space immediately following another collapsible space—even one
outside the boundary of the inline containing that space, provided they
are both within the same inline formatting context—is collapsed to
have zero advance width. (It is invisible, but retains its <a
href="#soft-wrap-opportunity"><i>soft wrap opportunity</i></a>, if
any.)
</ol>
<li>
<p>If ‘<a href="#white-space"><code
class=property>white-space</code></a>’ is set to ‘<code
class=css>pre-wrap</code>’, any sequence of spaces is treated as a
sequence of non-breaking spaces. However, a <a
href="#soft-wrap-opportunity"><i>soft wrap opportunity</i></a> exists at
the end of the sequence.
</ul>
<p>Then, the entire block is rendered. Inlines are laid out, taking bidi
reordering into account, and <a href="#wrapping"><i>wrapping</i></a> as
specified by the ‘<a href="#white-space"><code
class=property>white-space</code></a>’ property.
<div class=example id=egbidiwscollapse>
<p>The following example illustrates the interaction of white-space
collapsing and bidirectionality. Consider the following markup fragment,
taking special note of spaces (with varied backgrounds and borders for
emphasis and identification):
<pre><code><ltr>A<span class=egbidiwsaA> </span><rtl><span