-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.html
1378 lines (1377 loc) · 119 KB
/
Overview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>CSS Inline Layout Module Level 3</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="exploring" name="csswg-work-status">
<meta content="ED" name="w3c-status">
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
body {
background-image: url("https://www.w3.org/StyleSheets/TR/logo-ED");
};
</style>
<meta content="Bikeshed 1.0.0" name="generator">
<style media="print" type="text/css">
img#edge { width: 80%; height: 70%;}
dt.label { display: run-in; }
</style>
</head>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">CSS Inline Layout Module Level 3</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2016-01-31">31 January 2016</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://drafts.csswg.org/css-inline/">https://drafts.csswg.org/css-inline/</a>
<dt>Latest version:
<dd><a href="https://www.w3.org/TR/css-inline/">https://www.w3.org/TR/css-inline/</a>
<dt>Previous Versions:
<dd><a href="https://www.w3.org/TR/2015/WD-css-inline-3-20150917/" rel="previous">https://www.w3.org/TR/2015/WD-css-inline-3-20150917/</a>
<dd><a href="https://www.w3.org/TR/2014/WD-css-inline-3-20141218/" rel="previous">https://www.w3.org/TR/2014/WD-css-inline-3-20141218/</a>
<dd><a href="https://www.w3.org/TR/2002/WD-css3-linebox-20020515/" rel="previous">https://www.w3.org/TR/2002/WD-css3-linebox-20020515/</a>
<dt>Feedback:
<dd><span><a href="mailto:www-style@w3.org?subject=%5Bcss-inline%5D%20YOUR%20TOPIC%20HERE">www-style@w3.org</a> with subject line “<kbd>[css-inline] <i data-lt="">… message topic …</i></kbd>” (<a href="http://lists.w3.org/Archives/Public/www-style/" rel="discussion">archives</a>)</span>
<dt>Issue Tracking:
<dd><a href="#issues-index">Inline In Spec</a>
<dt class="editor">Editors:
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:dauwhe@gmail.com">Dave Cramer</a> (<span class="p-org org">Hachette Livre</span>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-url url" href="http://fantasai.inkedblade.net/contact">Elika J. Etemad / fantasai</a> (<span class="p-org org">Invited Expert</span>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:szilles@adobe.com">Steve Zilles</a> (<span class="p-org org">Adobe</span>)
<dt>Issues list:
<dd><span><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&product=CSS&component=Linebox&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">CSS3 Line Layout issues in Bugzilla</a></span>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2016 <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>). 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 no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<p>The CSS formatting model provides for a flow of elements and text inside of a container to be wrapped into lines. The formatting of elements and text within a line, its positioning in the inline progression direction, and the breaking of lines are described in <a data-link-type="biblio" href="#biblio-css3text">[CSS3TEXT]</a>. This module describes the positioning in the block progression direction both of elements and text within lines and of the lines themselves. This positioning is often relative to a baseline. It also describes special features for formatting of first lines and drop caps. It extends on the model in <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>.</p>
<a href="http://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="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>
<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=%5Bcss-inline%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 “css-inline” in the subject,
preferably like this:
“[css-inline] <em>…summary of comment…</em>” </p>
<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>
<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>
<p> This document is governed by the <a href="http://www.w3.org/2015/Process-20150901/" id="w3c_process_revision">1 September 2015 W3C Process Document</a>. </p>
<p></p>
</div>
<div data-fill-with="at-risk">
<p>The following features are at-risk, and may be dropped during the CR period: </p>
<ul>
<li>the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a> property
</ul>
<p>“At-risk” is a W3C Process term-of-art, and does not necessarily imply that the feature is in danger of being dropped or delayed. It means that the WG believes the feature may have difficulting being interoperably implemented in a timely manner, and marking it as such allows the WG to drop the feature if necessary when transitioning to the Proposed Rec stage, without having to publish a new Candidate Rec without the feature first.</p>
</div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
<li>
<a href="#line-height"><span class="secno">2</span> <span class="content">Line Heights and Baseline Alignment</span></a>
<ol class="toc">
<li><a href="#dominant-baseline-property"><span class="secno">2.1</span> <span class="content"> Dominant Baselines: the <span class="property">dominant-baseline</span> property</span></a>
<li>
<a href="#transverse-alignment"><span class="secno">2.2</span> <span class="content"> Transverse Box Alignment: the <span class="property">vertical-align</span> property</span></a>
<ol class="toc">
<li><a href="#alignment-baseline-property"><span class="secno">2.2.1</span> <span class="content"> Alignment Point: <span class="property">alignment-baseline</span> longhand</span></a>
<li><a href="#baseline-shift-property"><span class="secno">2.2.2</span> <span class="content"> Alignment Shift: <span class="property">baseline-shift</span> longhand</span></a>
</ol>
</ol>
<li>
<a href="#initial-letter-styling"><span class="secno">3</span> <span class="content"> Initial Letters</span></a>
<ol class="toc">
<li>
<a href="#initial-letter-intro"><span class="secno">3.1</span> <span class="content"> An Introduction to Initial Letters</span></a>
<ol class="toc">
<li><a href="#drop-initial"><span class="secno">3.1.1</span> <span class="content"> Drop Initial</span></a>
<li><a href="#sunk-initial"><span class="secno">3.1.2</span> <span class="content"> Sunken Initial Letters</span></a>
<li><a href="#raise-initial"><span class="secno">3.1.3</span> <span class="content"> Raised Initial Letters</span></a>
</ol>
<li><a href="#selecting-drop-initials"><span class="secno">3.2</span> <span class="content">Selecting Initial Letters</span></a>
<li>
<a href="#sizing-drop-initials"><span class="secno">3.3</span> <span class="content"> Creating Initial Letters: the <span class="property">initial-letter</span> property</span></a>
<ol class="toc">
<li><a href="#initial-letter-properties"><span class="secno">3.3.1</span> <span class="content"> Properties</span></a>
<li><a href="#initial-letter-model"><span class="secno">3.3.2</span> <span class="content"> Layout Model</span></a>
<li><a href="#initial-letter-box"><span class="secno">3.3.3</span> <span class="content"> Content-box Size, Margins, Borders, and Padding</span></a>
</ol>
<li>
<a href="#aligning-initial-letter"><span class="secno">3.4</span> <span class="content"> Alignment of Initial Letters: the <span class="property">initial-letter-align</span> property</span></a>
<ol class="toc">
<li><a href="#initial-letter-align-defaults"><span class="secno">3.4.1</span> <span class="content"> UA Default Stylesheet for <span class="property">initial-letter-align</span></span></a>
</ol>
<li>
<a href="#sizing-initial-letters"><span class="secno">3.5</span> <span class="content"> Sizing Initial Letters</span></a>
<ol class="toc">
<li><a href="#initial-letter-shaping"><span class="secno">3.5.1</span> <span class="content"> Shaping and Glyph Selection</span></a>
</ol>
<li><a href="#initial-letter-exclusions"><span class="secno">3.6</span> <span class="content"> Space Around Initial Letters</span></a>
<li><a href="#initial-letter-position"><span class="secno">3.7</span> <span class="content"> Positioning and Kerning Initial Letters</span></a>
<li><a href="#initial-letter-wrapping"><span class="secno">3.8</span> <span class="content"> Initial Letter Wrapping: the <span class="property">initial-letter-wrap</span> property</span></a>
<li><a href="#initial-letter-indentation"><span class="secno">3.9</span> <span class="content"> Indentation and Multi-line Effects</span></a>
<li>
<a href="#initial-letter-paragraphs"><span class="secno">3.10</span> <span class="content"> Clearing Initial Letters</span></a>
<ol class="toc">
<li><a href="#raised-sunken-caps"><span class="secno">3.10.1</span> <span class="content"> Raised and sunken caps</span></a>
<li><a href="#short-para-initial-letter"><span class="secno">3.10.2</span> <span class="content"> Short paragraphs with initial letters</span></a>
<li><a href="#initial-letter-floats"><span class="secno">3.10.3</span> <span class="content"> Interaction with floats</span></a>
</ol>
</ol>
<li>
<a href="#baseline-synthesis"><span class="secno"></span> <span class="content"> Appendix A: Synthesizing Baselines</span></a>
<ol class="toc">
<li><a href="#baseline-synthesis-fonts"><span class="secno"></span> <span class="content"> A.1: Synthesizing Baselines for Text</span></a>
<li><a href="#baseline-synthesis-replaced"><span class="secno"></span> <span class="content"> A.2: Synthesizing Baselines for Replaced Content</span></a>
</ol>
<li><a href="#ack"><span class="secno"></span> <span class="content"> Acknowledgments</span></a>
<li>
<a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
<ol class="toc">
<li><a href="#document-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
<li><a href="#conform-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
<li>
<a href="#conform-responsible"><span class="secno"></span> <span class="content"> Requirements for Responsible Implementation of CSS</span></a>
<ol class="toc">
<li><a href="#conform-partial"><span class="secno"></span> <span class="content"> Partial Implementations</span></a>
<li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a>
<li><a href="#conform-testing"><span class="secno"></span> <span class="content"> Implementations of CR-level Features</span></a>
</ol>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ol>
<li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a>
<li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
</ol>
</nav>
<main>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
<p>This module defines the CSS Inline Layout model,
replacing and extending the model as defined in CSS2.1.
It is very much a work-in-progress, and implementers should reference CSS2.1 for now.</p>
<p>The <dfn data-dfn-type="dfn" data-export="" id="root-inline-box">root inline box<a class="self-link" href="#root-inline-box"></a></dfn> is an anonymous inline box
which is automatically generated to hold
all of the <a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#inline-level">inline-level</a> contents of a <a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#block-container">block container</a> (if it has any).
It inherits from its parent <a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#block-container">block container</a>,
but is otherwise unstyleable.</p>
<h2 class="heading settled" data-level="2" id="line-height"><span class="secno">2. </span><span class="content">Line Heights and Baseline Alignment</span><a class="self-link" href="#line-height"></a></h2>
<p class="issue" id="issue-f1338dba"><a class="self-link" href="#issue-f1338dba"></a>This section is being rewritten. Refer to <a href="https://www.w3.org/TR/CSS2/visudet.html#line-height">section 10.8</a> of <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a> for the normative CSS definition or the <a href="https://www.w3.org/TR/2002/WD-css3-linebox-20020515/">2002 Working Draft</a> if you want pretty pictures. (But ignore the old text, half of it’s wrong. We’re not specifying which half, that’s to be determined.) <strong>The CSS2 specification should be used as the guideline for implementation.</strong></p>
<p class="issue" id="issue-95a9f423"><a class="self-link" href="#issue-95a9f423"></a> The CSSWG would like to know which baseline values are necessary: if any can be dropped, or any need to be added.</p>
<h3 class="heading settled" data-level="2.1" id="dominant-baseline-property"><span class="secno">2.1. </span><span class="content"> Dominant Baselines: the <a class="property" data-link-type="propdesc" href="#propdef-dominant-baseline">dominant-baseline</a> property</span><a class="self-link" href="#dominant-baseline-property"></a></h3>
<table class="def propdef" data-link-for-hint="dominant-baseline">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-dominant-baseline">dominant-baseline<a class="self-link" href="#propdef-dominant-baseline"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-bottom <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> central <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> mathematical <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hanging <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-top
<tr>
<th>Initial:
<td>normal
<tr>
<th>Applies to:
<td>block containers and inline boxes
<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
</table>
<p>This property specifies the <dfn data-dfn-type="dfn" data-noexport="" id="dominant-baseline">dominant baseline<a class="self-link" href="#dominant-baseline"></a></dfn>,
which is the baseline used to align the box’s text and inline-level contents.
Values have the following meanings:</p>
<dl>
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-auto">auto<a class="self-link" href="#valdef-dominant-baseline-auto"></a></dfn>
<dd> Equivalent to <a class="css" data-link-type="maybe" href="#valdef-dominant-baseline-alphabetic">alphabetic</a> in <i>horizontal writing modes</i> and in <i>vertical writing modes</i> when <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation">text-orientation</a> is <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-sideways">sideways</a>, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-sideways-right">sideways-right</a>, or <span class="css">sideways-left</span>.
equivalent to <a class="css" data-link-type="maybe" href="#valdef-dominant-baseline-central">central</a> in <i>vertical writing modes</i> when <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation">text-orientation</a> is <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-mixed">mixed</a> or <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-upright">upright</a>.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-text-bottom">text-bottom<a class="self-link" href="#valdef-dominant-baseline-text-bottom"></a></dfn>
<dd> Use the bottom of the em box as the baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-alphabetic">alphabetic<a class="self-link" href="#valdef-dominant-baseline-alphabetic"></a></dfn>
<dd> Use the alphabetic baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-central">central<a class="self-link" href="#valdef-dominant-baseline-central"></a></dfn>
<dd> Use the central baseline
(halfway between the ascent and descent).
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-mathematical">mathematical<a class="self-link" href="#valdef-dominant-baseline-mathematical"></a></dfn>
<dd> Use the mathematical baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-hanging">hanging<a class="self-link" href="#valdef-dominant-baseline-hanging"></a></dfn>
<dd> Use the hanging baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-text-top">text-top<a class="self-link" href="#valdef-dominant-baseline-text-top"></a></dfn>
<dd> Use the top of the em box as the baseline.
</dl>
<p>See <a data-link-type="biblio" href="#biblio-css3-writing-modes">[CSS3-WRITING-MODES]</a> for an introduction to dominant baselines.</p>
<p class="issue" id="issue-5c2889ea"><a class="self-link" href="#issue-5c2889ea"></a> Should be text-over and text-under instead of text-top and text-bottom,
but maybe it’s better not to use those terms for consistency with legacy <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a>.</p>
<h3 class="heading settled" data-level="2.2" id="transverse-alignment"><span class="secno">2.2. </span><span class="content"> Transverse Box Alignment: the <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a> property</span><a class="self-link" href="#transverse-alignment"></a></h3>
<table class="def propdef" data-link-for-hint="vertical-align">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-vertical-align">vertical-align<a class="self-link" href="#propdef-vertical-align"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod"><a class="production" data-link-type="propdesc" href="#propdef-baseline-shift"><‘baseline-shift’></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-any">||</a> <a class="production" data-link-type="propdesc" href="#propdef-alignment-baseline"><‘alignment-baseline’></a>
<tr>
<th>Initial:
<td>baseline
<tr>
<th>Applies to:
<td>inline-level boxes
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This shorthand property specifies how an inline-level box is aligned within the line.
Values are the same as for its longhand properties, see below. </p>
<p class="advisement"> Authors should use this property (<a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a>) instead of its longhands. </p>
<h4 class="heading settled" data-level="2.2.1" id="alignment-baseline-property"><span class="secno">2.2.1. </span><span class="content"> Alignment Point: <a class="property" data-link-type="propdesc" href="#propdef-alignment-baseline">alignment-baseline</a> longhand</span><a class="self-link" href="#alignment-baseline-property"></a></h4>
<table class="def propdef" data-link-for-hint="alignment-baseline">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-alignment-baseline">alignment-baseline<a class="self-link" href="#propdef-alignment-baseline"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">baseline <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-bottom <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> middle <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> central <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> mathematical <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-top <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> bottom <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> center <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> top
<tr>
<th>Initial:
<td>baseline
<tr>
<th>Applies to:
<td>inline-level boxes
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>Specifies what point of an inline-level box is aligned to what point in the parent.
Values are defined below: </p>
<p>For the following definitions, the margin box is used for atomic inlines,
and the leading box for non-replaced inlines:</p>
<dl>
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-baseline">baseline<a class="self-link" href="#valdef-alignment-baseline-baseline"></a></dfn>
<dd> Use the <i>dominant baseline</i> choice of the parent.
Match the box’s corresponding baseline to that of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-bottom">text-bottom<a class="self-link" href="#valdef-alignment-baseline-text-bottom"></a></dfn>
<dd> Match the bottom of the box to the bottom of the parent’s content area.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-alphabetic">alphabetic<a class="self-link" href="#valdef-alignment-baseline-alphabetic"></a></dfn>
<dd> Match the box’s alphabetic baseline to that of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-middle">middle<a class="self-link" href="#valdef-alignment-baseline-middle"></a></dfn>
<dd> Align the vertical midpoint of the box with
the baseline of the parent box plus half the x-height of the parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-central">central<a class="self-link" href="#valdef-alignment-baseline-central"></a></dfn>
<dd> Match the box’s central baseline to the central baseline of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-mathematical">mathematical<a class="self-link" href="#valdef-alignment-baseline-mathematical"></a></dfn>
<dd> Match the box’s mathematical baseline to that of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-top">text-top<a class="self-link" href="#valdef-alignment-baseline-text-top"></a></dfn>
<dd> Match the top of the box to the top of the parent’s content area.
</dl>
<p>For the following definitions, the <i>alignment subtree</i> is as defined in <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a>.</p>
<dl>
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-top">top<a class="self-link" href="#valdef-alignment-baseline-top"></a></dfn>
<dd> Align the top of the aligned subtree with the top of the line box.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-center">center<a class="self-link" href="#valdef-alignment-baseline-center"></a></dfn>
<dd> Align the center of the aligned subtree with the center of the line box.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-bottom">bottom<a class="self-link" href="#valdef-alignment-baseline-bottom"></a></dfn>
<dd> Align the bottom of the aligned subtree with the bottom of the line box.
</dl>
<p>SVG implementations <em>may</em> support the following aliases
in order to support legacy content:</p>
<pre><dfn data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-before-edge">text-before-edge<a class="self-link" href="#valdef-alignment-baseline-text-before-edge"></a></dfn> = <a data-link-type="maybe" href="#valdef-alignment-baseline-text-top">text-top</a>
<dfn data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-after-edge">text-after-edge<a class="self-link" href="#valdef-alignment-baseline-text-after-edge"></a></dfn> = <a data-link-type="maybe" href="#valdef-alignment-baseline-text-bottom">text-bottom</a>
</pre>
<p>These values are not allowed in the <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a> shorthand.</p>
<h4 class="heading settled" data-level="2.2.2" id="baseline-shift-property"><span class="secno">2.2.2. </span><span class="content"> Alignment Shift: <a class="property" data-link-type="propdesc" href="#propdef-baseline-shift">baseline-shift</a> longhand</span><a class="self-link" href="#baseline-shift-property"></a></h4>
<table class="def propdef" data-link-for-hint="baseline-shift">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-baseline-shift">baseline-shift<a class="self-link" href="#propdef-baseline-shift"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value"><length></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value"><percentage></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> sub <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> super
<tr>
<th>Initial:
<td>0
<tr>
<th>Applies to:
<td>inline-level boxes
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>refer to the used value of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">line-height</a>
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>absolute length, percentage, or keyword specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies by how much the box is shifted up
from its alignment point.
It does not apply when <a class="property" data-link-type="propdesc" href="#propdef-alignment-baseline">alignment-baseline</a> is <a class="css" data-link-type="maybe" href="#valdef-alignment-baseline-top">top</a> or <a class="css" data-link-type="maybe" href="#valdef-alignment-baseline-bottom">bottom</a>. </p>
<p class="advisement"> Authors should use the <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a> shorthand instead of this property. </p>
<p>Values have the following meanings:</p>
<dl>
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-length"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value"><length></a><a class="self-link" href="#valdef-baseline-shift-length"></a></dfn>
<dd>Raise (positive value) or lower (negative value) by the specified length.
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-percentage"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value"><percentage></a><a class="self-link" href="#valdef-baseline-shift-percentage"></a></dfn>
<dd>Raise (positive value) or lower (negative value) by the specified percentage of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">line-height</a>.
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-sub">sub<a class="self-link" href="#valdef-baseline-shift-sub"></a></dfn>
<dd>Lower by the offset appropriate for subscripts of the parent’s box.
(The UA should use the parent’s font data to find this offset whenever possible.)
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-super">super<a class="self-link" href="#valdef-baseline-shift-super"></a></dfn>
<dd>Raise by the offset appropriate for superscripts of the parent’s box.
(The UA should use the parent’s font data to find this offset whenever possible.)
</dl>
<p>User agents <em>may</em> additionally support the keyword <dfn data-dfn-for="baseline-shift" data-dfn-type="dfn" data-noexport="" id="baseline-shift-baseline">baseline<a class="self-link" href="#baseline-shift-baseline"></a></dfn> as computing to <span class="css">0</span> if is necessary for them to support legacy SVG content.
Issue: We would prefer to remove this, and are looking for feedback from SVG user agents as to whether it’s necessary. </p>
<h2 class="heading settled" data-level="3" id="initial-letter-styling"><span class="secno">3. </span><span class="content"> Initial Letters</span><a class="self-link" href="#initial-letter-styling"></a></h2>
<p class="issue" id="issue-f90429eb"><a class="self-link" href="#issue-f90429eb"></a>The editors would appreciate any examples of drop initials in non-western scripts, especially Arabic and Indic scripts.</p>
<h3 class="heading settled" data-level="3.1" id="initial-letter-intro"><span class="secno">3.1. </span><span class="content"> An Introduction to Initial Letters</span><a class="self-link" href="#initial-letter-intro"></a></h3>
<p>Large, decorative letters have been used to start new sections of text since before the invention of printing. In fact, their use predates lowercase letters entirely.</p>
<h4 class="heading settled" data-level="3.1.1" id="drop-initial"><span class="secno">3.1.1. </span><span class="content"> Drop Initial</span><a class="self-link" href="#drop-initial"></a></h4>
<p>A <dfn data-dfn-type="dfn" data-noexport="" id="dropped-initial">dropped initial<a class="self-link" href="#dropped-initial"></a></dfn> (or “drop cap”) is a larger-than-usual letter at the start of a paragraph, with a baseline at least one line lower than the first baseline of the paragraph. The size of the drop initial is usually indicated by how many lines it occupies. Two- and three-line drop initials are very common.</p>
<figure>
<img alt="3-line drop cap with E Acute" src="images/Dropcap-E-acute-3line.png" width="480">
<p class="caption">Three-line drop initial with E acute. Since the cap-height of the drop initial aligns with the cap-height of the main text, the accent extends above the paragraph.</p>
</figure>
<p>The exact size and position of a <a data-link-type="dfn" href="#dropped-initial">dropped initial</a> depends on the alignment of its glyph. Reference points on the drop cap must align precisely with reference points in the text. In Western scripts, the top reference points are the cap height of the initial letter and of the first line of text. The bottom reference points are the alphabetic baseline of the initial letter and the baseline of the Nth line of text. <a href="#f2">Figure 2</a> shows a simple two-line drop cap, with the relevant reference lines marked.</p>
<figure id="f2">
<img alt="drop cap showing alignment" src="images/Dropcap-lines.png" width="600">
<p class="caption">Two-line drop cap showing baselines (green lines), cap-height (red line), and ascender (cyan line).</p>
</figure>
<p>The alignment constraints for drop initials depend on the writing system. In ideographic scripts, the initial letter extends from the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-start">block-start</a> edge of the first line to the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-end">block-end</a> edge of the Nth line.</p>
<figure>
<img alt="Japanese Vertical Initial" src="images/Initial-2line-JapaneseVertical六.png" width="480">
<p class="caption">Two-line drop initial in vertical writing mode</p>
</figure>
<p>In some Indic scripts, the top alignment point
is the hanging baseline,
and the bottom alignment point is the text-after-edge.</p>
<figure>
<img alt="Devangari initial letter" src="images/Devangari-Initial.png" width="480">
<p class="caption">Devangari <a data-link-type="dfn" href="#initial-letter">initial letter</a> aligned with hanging baseline. Alignment points shown in red.</p>
</figure>
<h4 class="heading settled" data-level="3.1.2" id="sunk-initial"><span class="secno">3.1.2. </span><span class="content"> Sunken Initial Letters</span><a class="self-link" href="#sunk-initial"></a></h4>
<p>Some styles of drop initials do not align with the first line of text. A <dfn data-dfn-type="dfn" data-noexport="" id="sunken-initial">sunken initial<a class="self-link" href="#sunken-initial"></a></dfn> (or “sunken cap”) both sinks below the first baseline, and extends above the first line of text.</p>
<figure>
<img alt="sunken drop initial" src="images/SunkenCapA.png" width="480">
<p class="caption">Sunken cap. The letter drops two lines, but is the size of a three-line initial letter.</p>
</figure>
<h4 class="heading settled" data-level="3.1.3" id="raise-initial"><span class="secno">3.1.3. </span><span class="content"> Raised Initial Letters</span><a class="self-link" href="#raise-initial"></a></h4>
<p>A <dfn data-dfn-type="dfn" data-noexport="" id="raised-initial">raised initial<a class="self-link" href="#raised-initial"></a></dfn> (often called a “raised cap” or “stick-up cap”) “sinks” to the first text baseline.</p>
<p class="note" role="note">Note: A proper raised initial has several advantages
over simply increasing the font size of a first letter.
The line spacing in the rest of the paragraph
will not be altered, but text will still be excluded
around large descenders.
And if the size of raised initial is defined
to be an integral number of lines,
implicit baseline grids can be maintained.</p>
<figure>
<img alt="raised cap" src="images/RaisedCap.png" width="480">
<p class="caption">Raised cap. The initial letter is the size of a 3-line initial, but does not drop.</p>
</figure>
<h3 class="heading settled" data-level="3.2" id="selecting-drop-initials"><span class="secno">3.2. </span><span class="content">Selecting Initial Letters</span><a class="self-link" href="#selecting-drop-initials"></a></h3>
<p>Initial letters are typically a single letter, although
they may include punctuation or a sequence of characters which
are perceived by the user to be a single typographic unit.
The <code>::first-letter</code> pseudo-element, as defined in <a data-link-type="biblio" href="#biblio-select">[SELECT]</a>, can be used to select an <a data-link-type="dfn" href="#initial-letter">initial letter</a>.</p>
<p>Authors who need more control over which characters are included in an initial letter, or who want to apply initial-letter formatting to replaced elements or multiple words can also apply the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property to the first inline-level child of a block container. </p>
<div class="example" id="example-bab63235">
<a class="self-link" href="#example-bab63235"></a>
<pre><p>This paragraph has a dropped “T”.
<p><img alt="H" src="illuminated-h.svg">ere we have an illuminated “H”.
<p><span>Words may also</span> be given initial letter styling at the beginning of a paragraph.
</pre>
<pre>::first-letter, /* style first paragraph’s T */
img, /* style illuminated H */
span /* style phrase inside span */
{ initial-letter: 2; }
</pre>
</div>
<h3 class="heading settled" data-level="3.3" id="sizing-drop-initials"><span class="secno">3.3. </span><span class="content"> Creating Initial Letters: the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property</span><a class="self-link" href="#sizing-drop-initials"></a></h3>
<table class="def propdef" data-link-for-hint="<dfn id="propdef-initial-letter">initial-letter</dfn>">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter">initial-letter<a class="self-link" href="#propdef-initial-letter"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">normal <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> [<a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#number-value"><number></a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#integer-value"><integer></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-opt">?</a>]
<tr>
<th>Initial:
<td>normal
<tr>
<th>Applies to:
<td><code>::first-letter</code> pseudo-elements and inline-level first child of a block container
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies styling for dropped, raised, and sunken initial letters. It takes the following values:</p>
<dl>
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-normal">normal<a class="self-link" href="#valdef-initial-letter-normal"></a></dfn>
<dd>No special initial-letter effect. Text behaves as normal.
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-number"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#number-value"><number></a><a class="self-link" href="#valdef-initial-letter-number"></a></dfn>
<dd>This first argument defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed.
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-integer"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#integer-value"><integer></a><a class="self-link" href="#valdef-initial-letter-integer"></a></dfn>
<dd>This optional second argument argument defines the number of lines the initial letter should sink. Values must be greater than zero. If omitted, it duplicates the first argument, floored to the nearest positive whole number.
</dl>
<p class="issue" id="issue-4601aace"><a class="self-link" href="#issue-4601aace"></a> Should this be <span class="css">initial-letters</span> (plural) as originally discussed?
Since it can apply to multiple letters.</p>
<p>An <dfn data-dfn-type="dfn" data-lt="initial letter | initial letter box" data-noexport="" id="initial-letter">initial letter<a class="self-link" href="#initial-letter"></a></dfn> is
a box to which <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> applies and is not <a class="css" data-link-type="maybe" href="#valdef-initial-letter-normal">normal</a>:
this triggers the special layout considerations described below.</p>
<div class="example" id="example-7f3f9911">
<a class="self-link" href="#example-7f3f9911"></a> Here are some examples of <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> usage:
<dl>
<dt><a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3</a>
<dt>(<a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3 3</a>)
<dd>
Represents a <a data-link-type="dfn" href="#dropped-initial">dropped initial</a> 3 lines high, 3 lines deep.
<p><img alt="3 lines high, 3 lines deep" src="images/InitialLetter33.png" width="360"></p>
<dt><a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3 2</a>
<dd>
Represents a <a data-link-type="dfn" href="#sunken-initial">sunken initial</a> 3 lines high, 2 lines deep.
<p><img alt="3 lines high, 2 lines deep" src="images/InitialLetter32.png" width="360"></p>
<dt><a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3 1</a>
<dd>
Represents a <a data-link-type="dfn" href="#raised-initial">raised initial</a> 3 lines high, 1 line deep.
<p><img alt="3 lines high, 1 line deep" src="images/InitialLetter31.png" width="360"></p>
<dt><a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 2.51 3</a>
<dd>
The size of the initial letter does not have to be an integral number of lines. In this case only the bottom aligns.
<p><img alt="Non-integral initial letter that only aligns at base" src="images/non-integer-initial.png" width="360"></p>
</dl>
</div>
<div class="example" id="example-3c97a721">
<a class="self-link" href="#example-3c97a721"></a> The following code will create a 2-line dropped initial letter at the beginning of each paragraph:
<pre>p::first-letter { initial-letter: 2; }</pre>
</div>
<p class="issue" id="issue-cf76c839"><a class="self-link" href="#issue-cf76c839"></a> Define interaction with <a data-link-type="dfn" href="https://drafts.csswg.org/css-ruby-1/#ruby">ruby</a>. Easiest is to make it not apply to/within <a data-link-type="dfn" href="https://drafts.csswg.org/css-ruby-1/#ruby">ruby</a>.</p>
<p>The <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property does not apply to boxes that are not positioned at the start of the line due to bidi reordering.</p>
<h4 class="heading settled" data-level="3.3.1" id="initial-letter-properties"><span class="secno">3.3.1. </span><span class="content"> Properties</span><a class="self-link" href="#initial-letter-properties"></a></h4>
<p>The following properties apply to an <a data-link-type="dfn" href="#initial-letter">initial letter</a>:</p>
<ul>
<li>all font properties (see <a data-link-type="biblio" href="#biblio-css3-fonts">[CSS3-FONTS]</a>)
<li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0">color</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-4/#propdef-opacity">opacity</a> properties (see <a data-link-type="biblio" href="#biblio-css3color">[CSS3COLOR]</a>)
<li>all background properties (see <a data-link-type="biblio" href="#biblio-css3bg">[CSS3BG]</a>)
<li>any typesetting properties that apply to inline elements (see <a data-link-type="biblio" href="#biblio-css3text">[CSS3TEXT]</a>)
<li>all text decoration properties (see <a data-link-type="biblio" href="#biblio-css3-text-decor">[CSS3-TEXT-DECOR]</a>)
<li>all margin, border and padding properties (see <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a> and <a data-link-type="biblio" href="#biblio-css3bg">[CSS3BG]</a>)
</ul>
<p class="note" role="note">Note: Which properties apply to <a data-link-type="dfn" href="#initial-letter">initial letter</a> depend on whether it is an inline box or an <a data-link-type="dfn" href="#initial-letter">initial letter</a> box, as <a data-link-type="dfn" href="#initial-letter">initial letter</a> is a display type.</p>
<p class="issue" id="issue-939d845d"><a class="self-link" href="#issue-939d845d"></a> Add <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-width">width</a>/<a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-height">height</a> as requested by Tantek... need to integrate with model.</p>
<h4 class="heading settled" data-level="3.3.2" id="initial-letter-model"><span class="secno">3.3.2. </span><span class="content"> Layout Model</span><a class="self-link" href="#initial-letter-model"></a></h4>
<p>An <a data-link-type="dfn" href="#initial-letter">initial letter</a> is laid out following the steps outlined below:</p>
<ol>
<li>Find the used font size based on its <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> size, <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> alignment points, and font metrics.
Note that no layout is required in this step.
The font size used for sizing the <a data-link-type="dfn" href="#initial-letter">initial letter</a> contents <em>does not</em> affect its computed <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size">font-size</a> property
(and therefore has no effect on the computation of <span class="css">em</span> length values, etc.).
<li>Size the <a data-link-type="dfn" href="#initial-letter">initial letter</a>’s content box.
The content box of a non-atomic inline initial letter
is the smallest rectangle required to include the entirety of its glyphs
as well as the margin boxes of any atomic inlines it contains.
<li>The initial letter’s margin box is placed at the edge of the line.
If it has no padding or borders, it is negatively offset by the distance
from the start edge of its content box to the point in the content that
would have been placed at the start edge of the containing block if it had <a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: none</a>.
<li>Exclude content within the inline letter’s margin box
according to <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a>.
</ol>
<h4 class="heading settled" data-level="3.3.3" id="initial-letter-box"><span class="secno">3.3.3. </span><span class="content"> Content-box Size, Margins, Borders, and Padding</span><a class="self-link" href="#initial-letter-box"></a></h4>
<p>Initial letters can be styled with margins, padding, and borders just like any other box.
Unless <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> is <a class="css" data-link-type="maybe" href="#valdef-initial-letter-align-border-box">border-box</a>,
its vertical alignment and sizing are not affected;
however the effective exclusion area is (and corresponds to the margin area).</p>
<p>When padding and borders are zero, the initial letter may be kerned; see below.</p>
<h3 class="heading settled" data-level="3.4" id="aligning-initial-letter"><span class="secno">3.4. </span><span class="content"> Alignment of Initial Letters: the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> property</span><a class="self-link" href="#aligning-initial-letter"></a></h3>
<p>As mentioned earlier, the alignment of initial letters depends on the script used. The <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> property can be used to specify the proper alignment.</p>
<table class="def propdef" data-link-for-hint="<dfn id="propdef-initial-letter-align">initial-letter-align</dfn>">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter-align">initial-letter-align<a class="self-link" href="#propdef-initial-letter-align"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">border-box<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-opt">?</a> [ alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> ideographic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hebrew <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hanging ] <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> border-box
<tr>
<th>Initial:
<td>alphabetic
<tr>
<th>Applies to:
<td><code>::first-letter</code> pseudo elements and inline level first child of a block container
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>specified value
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies the alignment points used to size and position an <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
Two sets of alignment points are necessary:
the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> alignment points of the <a data-link-type="dfn" href="#initial-letter">initial letter</a> are matched to corresponding <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> points of the surrounding text.</p>
<p>Values have the following meanings:</p>
<dl>
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-alphabetic">alphabetic<a class="self-link" href="#valdef-initial-letter-align-alphabetic"></a></dfn>
<dd>Use the alphabetic and cap-height baselines of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-ideographic">ideographic<a class="self-link" href="#valdef-initial-letter-align-ideographic"></a></dfn>
<dd>Use the ideographic character face bottom and top edge baselines of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-hebrew">hebrew<a class="self-link" href="#valdef-initial-letter-align-hebrew"></a></dfn>
<dd>Use the alphabetic and (as yet theoretical) hebrew hanging baseline of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-hanging">hanging<a class="self-link" href="#valdef-initial-letter-align-hanging"></a></dfn>
<dd>Use the alphabetic and hanging baselines of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-border-box">border-box<a class="self-link" href="#valdef-initial-letter-align-border-box"></a></dfn>
<dd>Uses the <a data-link-type="dfn" href="#initial-letter">initial letter box</a>’s <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-over">line-over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-under">line-under</a> border edges
as the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> alignment points, respectively.
</dl>
<p class="issue" id="issue-c05ad357"><a class="self-link" href="#issue-c05ad357"></a> Is there proper a typographic term for the hebrew “hanging” baseline?</p>
<div class="example" id="example-ed08f99d">
<a class="self-link" href="#example-ed08f99d"></a> The vertical writing mode example from <a href="#f2">Figure 2</a> could be coded as:
<pre>span.initial {
initial-letter: 2;
initial-letter-align: ideographic;
}
</pre>
</div>
<div class="example" id="example-03ae6755">
<a class="self-link" href="#example-03ae6755"></a> Initial letter in Hebrew
<pre>span.initial {
initial-letter: 2;
initial-letter-align: hebrew;
}
<img alt="optical kerning in the presence or absence of a space after the initial letter" src="images/hebrew-initial-letter.png" width="480">
</pre>
</div>
<p>Except when <a class="css" data-link-type="maybe" href="#valdef-initial-letter-align-border-box">border-box</a> is specified,
the alignment points of the <a data-link-type="dfn" href="#initial-letter">initial letter</a> are automatically determined from its contents:</p>
<ol>
<li>If the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is an atomic inline,
use its <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> content-box edges.
<li>Else if the <a data-link-type="dfn" href="#initial-letter">initial letter</a> contains any character from the Han, Hangul, Kana, or Yi <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#unicode-script">Unicode scripts</a>,
use the ideographic character face bottom and top edge baselines.
<li>Else if the <a data-link-type="dfn" href="#initial-letter">initial letter</a> contains any character from the Devanagari, Bengali, and Gurmukhi <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#unicode-script">Unicode scripts</a>,
use the hanging and alphabetic baselines.
<li>Else if the <a data-link-type="dfn" href="#initial-letter">initial letter</a> contains any character from the Hebrew <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#unicode-script">Unicode scripts</a>,
use the ideographic character face bottom and top edge baselines.
<li>Else use the alphabetic and cap-height baselines.
</ol>
<p class="issue" id="issue-bf6dbf91"><a class="self-link" href="#issue-bf6dbf91"></a> What is the proper alignment for South Asian scripts that do not have the explicit hanging baseline, such as Tamil or Telugu?</p>
<p class="note" role="note">Note: The ordering of keywords in this property is fixed in case <a class="css" data-link-type="maybe" href="#valdef-initial-letter-align-border-box">border-box</a> is expanded to <span class="css">[ border-box | alphabetic | ideographic | hebrew | hanging ]</span> to allow explicitly specifying the <a data-link-type="dfn" href="#initial-letter">initial letter</a>’s alignment points.</p>
<h4 class="heading settled" data-level="3.4.1" id="initial-letter-align-defaults"><span class="secno">3.4.1. </span><span class="content"> UA Default Stylesheet for <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a></span><a class="self-link" href="#initial-letter-align-defaults"></a></h4>
<p>In order to provide the better behavior by default,
UAs must include in their default UA style sheet the following rules:</p>
<pre>[lang=zh], [lang=ja], [lang=ko], [lang=ii] {
initial-letter-align: ideographic;
}
[lang|=iw], [lang|=yi], [lang|=lad], [lang|=jrb] {
initial-letter-align: hebrew;
}
[lang|=hi], [lang|=mr], [lang|=ne], , [lang|=pi], [lang|=kok], [lang|=brx], [lang|=mai], [lang|=sd], [lang|=sa] {
initial-letter-align: hanging;
}
</pre>
<p class="issue" id="issue-4c0f245b"><a class="self-link" href="#issue-4c0f245b"></a> We don’t have a way to do subtag selection with attr selectors.
(It’s a feature of <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/selectors-4/#lang-pseudo">:lang()</a> in Selectors 4,
but we don’t want to use that because we want to hit the language root,
not all of the descendant elements.)
These selectors should also include the relevant script subtags.</p>
<h3 class="heading settled" data-level="3.5" id="sizing-initial-letters"><span class="secno">3.5. </span><span class="content"> Sizing Initial Letters</span><a class="self-link" href="#sizing-initial-letters"></a></h3>
<p>The size of a drop initial is determined by the need to satisfy the required alignment. For an N-line drop initial in a Western script, the cap-height of the letter needs to be (N – 1) times the line-height, plus the cap-height of the surrounding text. Note this height is <b>not</b> the font size of the drop initial.</p>
<p>Actually calculating this font size is tricky. For an N-line drop initial, we find the drop initial font size to be:</p>
<figure> <img alt="Equation to calcuate drop initial font size" src="images/InitialCapEquation.png" width="604"> </figure>
<p></p>
<p></p>
<div class="example" id="example-d15548da"><a class="self-link" href="#example-d15548da"></a> A three-line drop initial in Adobe Minion Pro would have a font size of 61.2pt, given 12pt text, 16pt line-height and a cap-height of 651/1000 (from the font’s OS/2 table). </div>
<p>The line height used in this calculation is the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">line-height</a> of the containing block (or, in the case where a baseline grid is in use, the baseline-to-baseline spacing required by the baseline grid <a data-link-type="biblio" href="#biblio-css3-line-grid">[CSS3-LINE-GRID]</a>). The contents of the lines spanned, and therefore any variation in their heights and positions, is not accounted for.</p>
<h4 class="heading settled" data-level="3.5.1" id="initial-letter-shaping"><span class="secno">3.5.1. </span><span class="content"> Shaping and Glyph Selection</span><a class="self-link" href="#initial-letter-shaping"></a></h4>
<p>When <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> is not <a class="css" data-link-type="maybe" href="#valdef-initial-letter-normal">normal</a>, shaping does not occur across the box’s boundaries,
as if the zero-width non-joiner (U+200C) were inserted before/after the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
For example, if the first letter of the Farsi word “پس” were styled with <a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 2 1</a>,
both letters would be styled in their isolated forms,
with “پ” as the initial letter, followed by the normally-styled “س”.</p>
<p class="issue" id="issue-bef56215"><a class="self-link" href="#issue-bef56215"></a> Are there other things we need to consider here?</p>
<h3 class="heading settled" data-level="3.6" id="initial-letter-exclusions"><span class="secno">3.6. </span><span class="content"> Space Around Initial Letters</span><a class="self-link" href="#initial-letter-exclusions"></a></h3>
<p>The glyph(s) of an initial letter do not always fit within the specified sink. For example, if an initial letter has a descender, it could crash into the (n+1)th line of text. This is not desirable.</p>
<figure>
<img alt="3-line drop cap with J, with descender crashing into fourth line of text" src="images/Dropcap-J-3line-crash.png" width="480">
<p class="caption">Incorrect: three-line initial letter with descender</p>
</figure>
<p>Text is therefore excluded around the glyph bounding boxes of the initial letters.</p>
<p>Specifically, for non-atomic initial letters, the content box of the element is sized to fit:</p>
<ul>
<li>The specified amount of sink (i.e the distance from the top alignment point to the bottom alignment point).
<li>The actual ascent and descent and side bearings of all the glyphs it contains that are part of its inline formatting context, even if they leak outside their em boxes.
<li>The margin boxes of all the atomic inlines it contains that are part of its inline formatting context, even if they leak outside its own line-height.
</ul>
<p>The margin box of the initial letter is then made an exclusion area for subsequent text.</p>
<figure>
<img alt="3-line drop cap with J, but four-line exclusion" src="images/Dropcap-J-3line-exclude.png" width="480">
<p class="caption">Correct: text excluded around glyph bounding box</p>
</figure>
<h3 class="heading settled" data-level="3.7" id="initial-letter-position"><span class="secno">3.7. </span><span class="content"> Positioning and Kerning Initial Letters</span><a class="self-link" href="#initial-letter-position"></a></h3>
<p>In the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-axis">block axis</a>, the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is positioned to satisfy its alignment requirements. (See <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a>.)</p>
<p>In the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#inline-axis">inline axis</a>, the position of the inline letter is given by aligning its start margin edge to the start edge of the containing block.</p>
<p>However, if the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is a non-atomic inline with zero padding and borders, the UA must apply an additional negative offset on the start side of the amount necessary to optically align the first glyph to the containing block edge as it would be in normal text.</p>
<h3 class="heading settled" data-level="3.8" id="initial-letter-wrapping"><span class="secno">3.8. </span><span class="content"> Initial Letter Wrapping: the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a> property</span><a class="self-link" href="#initial-letter-wrapping"></a></h3>
<p class="note" role="note">Note: <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a> is at risk.</p>
<table class="def propdef" data-link-for-hint="<dfn id="propdef-initial-letter-wrap">initial-letter-wrap</dfn>">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter-wrap">initial-letter-wrap<a class="self-link" href="#propdef-initial-letter-wrap"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">none <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> first <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> all <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> grid <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value"><length></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value"><percentage></a>
<tr>
<th>Initial:
<td>none
<tr>
<th>Applies to:
<td><code>::first-letter</code> pseudo-elements and inline-level first child of a block container
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>relative to <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#logical-width">logical width</a> of (last fragment of) initial letter
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies whether lines impacted by an <a data-link-type="dfn" href="#initial-letter">initial letter</a> are shortened to fit the rectangular shape of the <a data-link-type="dfn" href="#initial-letter">initial letter</a> box
or follow the contour of its end-edge glyph outline.</p>
<dl>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-none">none<a class="self-link" href="#valdef-initial-letter-wrap-none"></a></dfn>
<dd>No contour-fitting is performed:
each impacted line is aligned flush to the end margin edge of the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-first">first<a class="self-link" href="#valdef-initial-letter-wrap-first"></a></dfn>
<dd>
Behaves as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a> if
the first <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#typographic-character-unit">typographic character unit</a> after the <a data-link-type="dfn" href="#initial-letter">initial letter</a> belongs to Unicode General Category Zs.
Otherwise behaves as for <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-all">all</a> on the first line of the block containing the initial letter
and as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a> on the rest.
<div class="example" id="example-cdb7c78e">
<a class="self-link" href="#example-cdb7c78e"></a> This example shows why the contour-fitting the first line is necessary,
and why it is dropped when the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is followed by a space:
<figure>
<img alt="optical kerning in the presence or absence of a space after the initial letter" src="images/OpticalKerning.png" width="200">
<p class="caption"> In the top paragraph, the initial letter "A" has a word space after it:
the gap between the top of the "A" and the next letter provides the necessary word separation.
In the next paragraph, the initial letter "A" is part of the first word,
and leaving a gap between the top of the "A" and the next letter would create a jarring visual break within the word.
In this case, the first line of text should be kerned into the initial letter’s area, as shown in the bottom paragraph. </p>
</figure>
</div>
<p class="issue" id="issue-a826765c"><a class="self-link" href="#issue-a826765c"></a> Do we need an unconditional <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a>?
(I.e. Should we rename this value to <a class="css" data-link-type="maybe" href="#valdef-dominant-baseline-auto">auto</a> and add a <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> value that does not check for spaces?)</p>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-all">all<a class="self-link" href="#valdef-initial-letter-wrap-all"></a></dfn>
<dd>For each line of text impacted by the initial letter, the line box adjacent to the intial letter starts at the start-most point that touches the ink of the initial letter, plus the amount of the <a data-link-type="dfn" href="#initial-letter">initial letter</a>’s end-side border+padding+margin.
<p class="note" role="note">Note: This value is at-risk.</p>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-grid">grid<a class="self-link" href="#valdef-initial-letter-wrap-grid"></a></dfn>
<dd>
This value is the same as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a>,
except that the exclusion area of the impacted lines
is increased as necessary for its end-edge to land on the character grid.
The <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-align-3/#propdef-justify-self">justify-self</a> property can then be used to align the initial letter box
within the exclusion area.
<p>The heuristic for matching the character grid is
1em × <var>n</var> + <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-letter-spacing">letter-spacing</a> × (<var>n</var> - 1),
where <var>n</var> is the size of the initial letter
as specified by the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property,
and 1em represents the typical character advance width for ideographic characters
(and may be replaced by a more accurate value if known).</p>
<figure>
<img alt="Diagram of Japanese initial letter in vertical writing mode" src="images/CJK-Initial.001.png" width="480">
<p class="caption">Diagram of Japanese initial letter in vertical writing mode</p>
</figure>
<p class="note" role="note">Note: In this example, the exclusion area for the drop initial
is larger than its glyph in order to preserve inline-axis alignment.</p>
<p class="note" role="note">Note: This value is also at-risk.</p>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-length"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value"><length></a><a class="self-link" href="#valdef-initial-letter-wrap-length"></a></dfn>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-percentage"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value"><percentage></a><a class="self-link" href="#valdef-initial-letter-wrap-percentage"></a></dfn>
<dd>
This value behaves the same as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> except that the adjustment to the first line is given explicitly
instead of being inferred from the glyph shape.
<p class="issue" id="issue-645378a9"><a class="self-link" href="#issue-645378a9"></a> This really needs font-relative lengths to be relative to the used size.</p>
<p class="note" role="note">Note: This value exists because it is easier to implement.
Authors are encouraged to use the <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> value
and to set margins to control spacing,
and to use this as a fallback for glyph detection if necessary.</p>
<div class="example" id="example-e11c0dc6">
<a class="self-link" href="#example-e11c0dc6"></a> In the following example, UAs that support <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> will use the glyph outline
plus the specified margin in order to place the first line,
whereas UAs that only support <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value"><length></a> or <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value"><percentage></a> values
will pull in the first line by 40% of the initial letter’s width
(and then add the margin to that point).
<pre>h1 + p:first-letter {
initial-letter: 3; /* 3-line drop-cap */
initial-letter-wrap: first;
margin-right: 0.1em;
}
@supports (not (initial-letter-wrap: first)) {
/* Classes auto-generated on paragraphs to match first letter. */
p.A:first-letter {
initial-letter-wrap: -40%; /* Start of glyph outline, assuming correct font. */
}
}
</pre>
</div>
<p class="issue" id="issue-76db6c38"><a class="self-link" href="#issue-76db6c38"></a> These values and related annoyance is likely unnecessary if someone submits a patch to Blink to support <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a>.</p>
</dl>
<p class="issue" id="issue-c4ff3304"><a class="self-link" href="#issue-c4ff3304"></a> Edit figure to show how auto behaves in varying contexts</p>
<div class="example" id="example-768e3a03">
<a class="self-link" href="#example-768e3a03"></a>
<pre>p::first-letter {
initial-letter: 3;
initial-letter-wrap: none;
}
</pre>
<p><img alt="regular dropcap A" src="images/A-wraparound-none.png" width="600"></p>
<p>Ordinary initial letter with no wrapping.</p>
</div>
<div class="example" id="example-246e91df">
<a class="self-link" href="#example-246e91df"></a>
<pre>p::first-letter {
initial-letter: 3;
initial-letter-wrap: all;
}
</pre>
<p><img alt="text wrapping around dropcap A" src="images/A-wraparound.png" width="600"></p>
<p>Text follows shape of initial letter. Each line box should just touch the ink of the letter, with some offset (represented by the shaded box).</p>
</div>
<div class="example" id="example-5f1034eb">
<a class="self-link" href="#example-5f1034eb"></a>
<pre>p::first-letter {
initial-letter: 3;
initial-letter-wrap: first;
}
</pre>
<p><img alt="text wrapping around dropcap A but only on first line" src="images/A-wraparound-first.png" width="600"></p>
<p>Only the first line is moved up against the ink of the initial letter.</p>
</div>
<div class="example" id="example-6bc85a3f">
<a class="self-link" href="#example-6bc85a3f"></a>
<p><img alt="text wrapping around dropcap V" src="images/V-wraparound.png" width="600"></p>
</div>
<div class="example" id="example-9b96d6e5">
<a class="self-link" href="#example-9b96d6e5"></a>
<p><img alt="text wrapping around dropcap P" src="images/P-wraparound.png" width="600"></p>
</div>
<div class="example" id="example-9d9f2b4a">
<a class="self-link" href="#example-9d9f2b4a"></a>
<p><img alt="text wrapping around dropcap W" src="images/W-wraparound.png" width="600"></p>
</div>
<h3 class="heading settled" data-level="3.9" id="initial-letter-indentation"><span class="secno">3.9. </span><span class="content"> Indentation and Multi-line Effects</span><a class="self-link" href="#initial-letter-indentation"></a></h3>
<p><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-text-indent">text-indent</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-hanging-punctuation">hanging-punctuation</a> apply to the first line of text as normal in the presence of initial letters. Lines affected by the exclusion are shortened, as in the presence of floats, and are affected the same way.</p>
<p>If an initial letter is too long to fit on one line, it wraps (according to the usual text-wrapping rules), each line filled and formatted exactly as if it were the first line and the initial letter too long to fit any subsequent normal text. Any normal text after the initial letter starts on its last line, affected exactly as if that line were the first line.</p>
<figure>
<img alt="multi-line drop cap" src="images/Multi-line-initial.png" width="300">
<p class="caption">Drop cap extends to two lines.</p>
</figure>
<h3 class="heading settled" data-level="3.10" id="initial-letter-paragraphs"><span class="secno">3.10. </span><span class="content"> Clearing Initial Letters</span><a class="self-link" href="#initial-letter-paragraphs"></a></h3>
<h4 class="heading settled" data-level="3.10.1" id="raised-sunken-caps"><span class="secno">3.10.1. </span><span class="content"> Raised and sunken caps</span><a class="self-link" href="#raised-sunken-caps"></a></h4>
<p>An initial letter does not affect the position of its containing element. For “raised caps” or “sunken caps,” the effect is created as if the text around the initial letter was pushed down, rather than the letter extending up into previous elements.</p>
<figure>
<img alt="raised cap para after normal para" src="images/initial-letter-drop-para-compare.png" width="600">
<p class="caption">Raised cap (<code>initial-letter: 3 1</code>) on right; note that the position of the “C” is the same in both cases, but on the right all text is moved down relative to the initial letter.</p>
</figure>
<p class="issue" id="issue-f77cbeb9"><a class="self-link" href="#issue-f77cbeb9"></a> Handle glyph ink above cap height of font.</p>
<h4 class="heading settled" data-level="3.10.2" id="short-para-initial-letter"><span class="secno">3.10.2. </span><span class="content"> Short paragraphs with initial letters</span><a class="self-link" href="#short-para-initial-letter"></a></h4>
<p>A paragraph with an initial letter can have fewer lines of text than the initial letter occupies. In this case, the initial letter’s top alignment is still honored, and its exclusion area continues into any subsequent blocks. This forces the subsequent inline-level content to wrap around the initial letter—exactly as if that block’s text were part of its own containing block. (This is similar to how floats exclude content in subsequent block boxes.)</p>
<figure>
<img alt="short para with initial letter" src="images/initial-letter-short-para.png" width="600">
<p class="caption">The red text is a short paragraph with an initial letter. Note the subsequent paragraph wraps around the initial letter just as text in the paragraph with the initial letter does.</p>
</figure>
<p>If the subsequent block starts with an initial letter,
establishes a new formatting context,
or specifies <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visuren.html#propdef-clear">clear</a> in the initial letter’s containing block’s start direction,
then it must clear the previous block’s initial letter.</p>
<figure>
<img alt="short para with initial letter followed by para with initial" src="images/initial-letter-short-para-initial.png" width="600">
<p class="caption">The red text is a short paragraph with an initial letter. The subsequent paragraph clears because it also has an initial letter.</p>
</figure>
<h4 class="heading settled" data-level="3.10.3" id="initial-letter-floats"><span class="secno">3.10.3. </span><span class="content"> Interaction with floats</span><a class="self-link" href="#initial-letter-floats"></a></h4>
<p>Floats always clear an initial letter when floated to the same side. When floated to the opposite side, they are pushed down to clear the initial letter only if they have specified <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visuren.html#propdef-clear">clear</a> to this side or they do not fit without overlapping the initial letter.</p>
<p class="issue" id="issue-2ad0a0cb"><a class="self-link" href="#issue-2ad0a0cb"></a> Is this the behavior we want? What if the float is on the same line as the initial letter?</p>
<h2 class="no-num heading settled" id="baseline-synthesis"><span class="content"> Appendix A: Synthesizing Baselines</span><a class="self-link" href="#baseline-synthesis"></a></h2>
<h3 class="no-num heading settled" id="baseline-synthesis-fonts"><span class="content"> A.1: Synthesizing Baselines for Text</span><a class="self-link" href="#baseline-synthesis-fonts"></a></h3>
<p>Some fonts may not contain the baseline information necessary to align properly as described above.
User agents may follow these steps in the absence of a required metric:</p>
<ol>
<li>
Measure the font.
<div class="issue" id="issue-3c6d3ab2"><a class="self-link" href="#issue-3c6d3ab2"></a>Describe in more detail.
Should we document which characters in which scripts are useful,
such as lowercase "o" to measure x-height? See https://drafts.csswg.org/css-values/#ex</div>
<li>Use a heuristic for the script.
<li>
Use fallback values:
<ol>
<li>x-height: .5em;
<li>cap-height: .66em;
<li>hanging baseline: .6em;
</ol>
</ol>
<h3 class="no-num heading settled" id="baseline-synthesis-replaced"><span class="content"> A.2: Synthesizing Baselines for Replaced Content</span><a class="self-link" href="#baseline-synthesis-replaced"></a></h3>
<p class="issue" id="issue-7c764dce"><a class="self-link" href="#issue-7c764dce"></a> Copy over text from <a href="https://www.w3.org/TR/css-writing-modes-3/#replaced-baselines">CSS Writing Modes</a> and expand for additional baseline values.</p>
<p class="note" role="note">Note: Authors can use margins (positive or negative)
to adjust the alignment of replaced content within a line.</p>
<div class="example" id="example-f7450f42">
<a class="self-link" href="#example-f7450f42"></a> In this example, the author is using a set of images
to display characters that don’t exist.
<pre>img[src^="/text/"] {
height: 1em; /* Size to match adjacent text */
margin-bottom: -0.2em; /* Baseline at 20% above bottom */
}
...
<p>This is some text with words written in an unencoded script:
<img src="/text/ch3439.png" alt="...">
<img src="/text/ch3440.png" alt="...">
<img src="/text/ch3442.png" alt="...">
</pre>
</div>
<p class="note" role="note">Note: A future level of CSS may include a way of specifying a full baseline table for replaced elements.
(This will probably look like a <span class="css">baseline-table</span> property
that accepts ''[<baseline-keyword> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value"><percentage></a>]+''.)</p>
<h2 class="no-num heading settled" id="ack"><span class="content"> Acknowledgments</span><a class="self-link" href="#ack"></a></h2>
<p>Special thanks goes to the initial authors,
Eric A. Meyer and Michel Suignard. </p>
<p>In additions to the authors, this specification would not have been possible without the help from: </p>
<p>David Baron, John Daggett, Stephen Deach, Sujal Parikh, Grzegorz Zygmunt, Chris Wilson, David M Brown, Bobby Tung, Shinyu Murakami, David Hyatt, Sylvain Galineau, Alan Stearns, Ted O’Connor, Florian Rivoal. </p>
</main>
<h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
<h3 class="heading settled" id="document-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#document-conventions"></a></h3>
<p>Conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words “MUST”,
“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
document are to be interpreted as described in RFC 2119.
However, for readability, these words do not appear in all uppercase
letters in this specification. </p>
<p>All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
<p>Examples in this specification are introduced with the words “for example”
or are set apart from the normative text with <code>class="example"</code>,
like this: </p>
<div class="example" id="example-52448c84">
<a class="self-link" href="#example-52448c84"></a>
<p>This is an example of an informative example. </p>
</div>
<p>Informative notes begin with the word “Note” and are set apart from the
normative text with <code>class="note"</code>, like this: </p>
<p class="note" role="note">Note, this is an informative note. </p>
<p>Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with <code><strong class="advisement"></code>, like
this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p>
<h3 class="heading settled" id="conform-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conform-classes"></a></h3>
<p>Conformance to this specification
is defined for three conformance classes: </p>
<dl>
<dt>style sheet
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#style-sheet">CSS
style sheet</a>.
<dt>renderer
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders
documents that use them.
<dt>authoring tool
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that writes a style sheet.
</dl>
<p>A style sheet is conformant to this specification
if all of its statements that use syntax defined in this module are valid
according to the generic CSS grammar and the individual grammars of each
feature defined in this module. </p>
<p>A renderer is conformant to this specification
if, in addition to interpreting the style sheet as defined by the
appropriate specifications, it supports all the features defined
by this specification by parsing them correctly
and rendering the document accordingly. However, the inability of a
UA to correctly render a document due to limitations of the device
does not make the UA non-conformant. (For example, a UA is not
required to render color on a monochrome monitor.) </p>
<p>An authoring tool is conformant to this specification
if it writes style sheets that are syntactically correct according to the
generic CSS grammar and the individual grammars of each feature in
this module, and meet all other conformance requirements of style sheets
as described in this module. </p>