-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.bs
executable file
·3041 lines (2243 loc) · 114 KB
/
Overview.bs
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
<h1>CSS Inline Layout Module Level 3</h1>
<style media="print" type="text/css">
img#edge { width: 80%; height: 70%;}
dt.label { display: run-in; }
</style>
<pre class='metadata'>
Shortname: css-inline
Level: 3
Status: ED
Group: csswg
TR: http://www.w3.org/TR/css-inline/
ED: http://dev.w3.org/csswg/css-inline/
Previous version: http://www.w3.org/TR/2002/WD-css3-linebox-20020515/
!Issues list: <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>
Editor: Dave Cramer, Hachette Livre, dauwhe@gmail.com
Editor: Elika J. Etemad, Invited Expert, http://fantasai.inkedblade.net/contact
Editor: Steve Zilles, Adobe, szilles@adobe.com
Abstract: 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 [[CSS3TEXT]]. 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 [[CSS2]].
Ignored Terms: guru, ji, line-height-shift-adjustment, text-script, after, before
</pre>
<h2 id="LineBox">Line box, Line stacking and Content height</h2>
<p>This section describes inline boxes formatting, how lines are stacked
together and a mechanism to adjust the content height of inline elements. Two
terms: inline-progression dimension and block-progression dimension are used
frequently in the section and are defined as follows
<p>The <b>inline-progression
dimension</b> is a length in the direction of the inline-progression of a box.
For an horizontal layout flow it can be perceived as related to the the width of
the box. However for a vertical layout flow it will be related to the height of
the box. The term inline-progression dimension is the neutral way to express
that dimension independently of the layout flow.
<p>The <b>block-progression dimension</b> is a length in the direction of the
block-progression of a box. For an horizontal layout flow it can be perceived as
related to the height of the box. However for a vertical layout flow it will be
related to the width of the box. The term block-progression dimension is the
neutral way to express that dimension independently of the layout flow.
<h3 id="InlineFormatting">Inline formatting context</h3>
<p>In an inline formatting context, boxes are laid out in the inline-progression
direction, one after
the other, following the block-progression within the containing block. Borders,
padding and inline-progression margins are respected between these boxes. The boxes may be aligned
within the inline-progression in different ways: their under-edges or
over-edges may be aligned, or the
baselines of text within them may be aligned. The rectangular area that contains
the boxes that form a line is called a <dfn id="line-box">line box</dfn>.
<p>The inline-progression dimension ('width' in horizontal flow) of a line box is
determined by its containing block. The block-progression dimension ('height' in
horizontal flow) of a line box is determined by the rules given
in the section on
<a href="#line-height">line height
calculations</a>. A line box is generally tall (relative) enough for all of the boxes it
contains. However, it may be taller than the tallest box it contains (if, for
example, boxes are aligned so that baselines line up). The alignment of boxes
within a line box is determined by the
<a href="#baseline">baseline alignment</a> properties.</p>
<p>In general, when several inline boxes cannot fit within a single line box,
they are distributed among two or more block-progression stacked line boxes. The
exact wrapping of inline boxes at the line ending edge is determined by several
text related property categories such as line-breaking, word-breaking, text
wrapping and white-space management. Thus, a
paragraph is a stack of line boxes.</p>
<p>Line boxes are stacked together in the block-progression direction
without any separation. The block-progression dimension of the line box
is determined by the contents of the line box (including the root inline
box) and the 'line-box-contain' property.</p>
<p>A containing block defines a <b>root inline box</b> which wraps all the
inline children of the block element, including the anonymous inline boxes.
It inherits inheritable properties from the parent block
box (like 'line-height'), while non-inherited
properties have their default values. The root inline box establishes a
baseline for vertical alignment and may affect the height of the line
boxes.</p>
<p>Although margins, borders, and padding of non-replaced elements do not enter
into inline box block-progression dimension calculation (and thus the line box
calculation), they are still rendered around inline boxes. This means that if
the block-progression dimension of a line box is shorter than the
<a href="http://www.w3.org/TR/REC-CSS2/box.html#outer-edge">outer edges</a> of
the boxes it contains, backgrounds and colors of padding and borders may "bleed"
into adjacent line boxes. However, in this case, some user agents may use the
line box to "clip" the border and padding areas (i.e., not render them). </p>
<h3 id="LineBoxWrapping">Inline-progression: Line Box wrapping</h3>
<p>In general, the start edge of a line box touches the start edge of its
containing block and the end edge touches the end edge of its containing block.
However, floating boxes may come between the containing block edge and the line
box edge. Thus, although line boxes in the same inline formatting context
generally have the same inline-progression dimension (that of the
containing block), they may vary if available inline-progression space
is reduced due to <!-- a href="#floats"-->
floats<!--/a-->. Line boxes in the same inline formatting context may vary in
block-progression dimension.</p>
<p>When the total inline-progression dimension of the inline boxes on a line is less than the
inline-progression dimension of
the line box containing them, their inline-progression distribution within the line box
is determined by the
'text-align' property. If that
property has the value ''justify'', the user agent may stretch the inline boxes as
well. </p>
<p>When line-breaking opportunities are available within inline boxes and are
not pre-empted by the white-space properties, the inline boxes located at the
ending edge of the line box may be split into several boxes and these boxes
distributed across several line boxes. When an inline box is split, margins, borders, and padding have no visual
effect where the split occurs (or at any split, when they are several). Formatting of margins, borders, and padding may
not be fully defined if the split occurs within a bidirectional embedding. </p>
<p>Inline boxes may also be split into several boxes <em>within the same line
box</em> due to <a href="#direction">bidirectional text processing</a>. </p>
<div class="html-example">
Here is an example of inline box construction. The following paragraph
(created by the HTML block-level element P) contains anonymous text
interspersed with the elements EM and STRONG:
<pre><P>Several <EM>emphasized words</EM> appear
<STRONG>in this</STRONG> sentence, dear.</P>
</pre>
<p>The P element generates a block box that contains five inline boxes, three
of which are anonymous:</p>
<ul>
<li>Anonymous: "Several" </li>
<li>EM: "emphasized words" </li>
<li>Anonymous: "appear" </li>
<li>STRONG: "in this" </li>
<li>Anonymous: "sentence, dear." </li>
</ul>
<p>To format the paragraph, the user agent flows the five boxes into line
boxes. In this example, the box generated for the P element establishes the
containing block for the line boxes. If the containing block is sufficiently
wide (relative) , all the inline boxes will fit into a single line box: </p>
<pre> Several <em>emphasized words</em> appear <strong>in this</strong> sentence, dear.
</pre>
<p>If not, the inline boxes will be split up and distributed across several
line boxes. The previous paragraph might be split as follows: </p>
<pre>Several <em>emphasized words</em> appear
<strong>in this</strong> sentence, dear.
</pre>
<p>or like this: </p>
<pre>Several <em>emphasized</em>
<em>words</em> appear <strong>in this</strong>
sentence, dear.
</pre>
</div>
<p>In the previous example, the EM box was split into two EM boxes (call them
"split1" and "split2"). Margins, borders, padding, or text decorations have no
visible effect after split1 or before split2. </p>
<div class="html-example">
Consider the following example:
<pre><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<TITLE>Example of inline flow on several lines</TITLE>
<STYLE type="text/css">
EM {
padding: 2px;
margin: 1em;
border-width: medium;
border-style: dashed;
line-height: 2.4em;
}
</STYLE>
</HEAD>
<BODY>
<P>Several <EM>emphasized words</EM> appear here.</P>
</BODY>
</HTML>
</pre>
<p>Depending on the width of the P, the boxes may be distributed as follows:</p>
<div class="figure">
<img alt="Image illustrating the effect of line breaking on the
display of margins, borders, and padding." src="inline-layout.gif" width="260" height="99"><span class="dlink"> <a title="Long description for illustration of margin/border
behavior on split inline box" href="http://www.w3.org/TR/REC-CSS2/images/longdesc/inline-layout-desc.html" name="img-inline-layout">[D]</a></span></div>
<ul>
<li>The margin is inserted before "emphasized" and after "words". </li>
<li>The padding is inserted before, above, and below "emphasized" and after,
above, and below "words". A dashed border is rendered on three sides in each
case. </li>
</ul>
</div>
<h3 id="inline1">Block-progression dimensions: the
'text-height' property</h3>
<p>Each inline box has a block-progression dimension which is derived from the
following parameters: the 'text-height' and 'font-size' properties for
non-replaced elements, the height or the width for replaced elements (depending
on the text flow being horizontal or vertical respectively) and the stacked
block-progression dimension for inline-block elements (identical to what is done
for block-level elements).</p>
<p>The block-progression dimension determines the position of the padding,
border and margin for the element but does not necessarily determine the line
stacking progression as this is also affected by the 'line-box-contain'
property.</p>
<table class="propdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>text-height</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td>auto | font-size | text-size | max-size | <number></td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>auto</td>
</tr>
<tr>
<td><em>Applies to:</em></td>
<td>inline elements and parents of element with display:ruby-text</td>
</tr>
<tr>
<td><em>Inherited:</em></td>
<td>yes</td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual</td>
</tr>
<tr>
<td><em>Computed value:</em></td>
<td>specified value (except for initial and inherit)</td>
</tr>
</tbody>
</table>
<p>The 'text-height' property determine the block-progression dimension of the
text content area of an inline box (non-replaced elements) . Possible values:</p>
<dl>
<dt><strong>auto</strong>
<dd>The block-progression dimension is based either on the em square determined
by the computed element font-size property value or the cell-height (ascender + descender)
related to the computed element font-size as chosen by the user agent.
<dt>font-size</dt>
<dd>The block-progression dimension is based on the em square as determined by
the computed element font-size. </dd>
<dt>text-size</dt>
<dd>The block-progression dimension is based on the cell-height (ascender +
descender) related to the computed element font-size.</dd>
<dt>max-size</dt>
<dd>The block-progression dimension is based on the maximum extents toward the
over-edge and under-edge of the box obtained by considering all children
elements located on the same line, ruby annotations (elements with 'display:ruby-text')
and baseline shifted elements.</dd>
<dt><number></dt>
<dd>The block progression dimension is based on <number> times the em square as
determined by the computed font-size.</dd>
</dl>
<p>When more than one font-size is used (this could happen when glyphs are found
in different fonts), it is recommended that the largest font-size provides the em square and the cell-height.</p>
<p>Although the 'text-height' property does not apply directly to block
elements, it applies to their anonymous children inline boxes (if any).</p>
<p>For replaced elements, the block-progression dimension is determined by the
outer edges (i.e. margin edge).</p>
<h3 id="LineBoxHeight">Block progression positioning and spacing</h3>
<h4 id="InlineBoxHeight">Line height adjustment: the
'line-height' property</h4>
<p>The 'line-height' property controls the amount of leading space
which is added over and under an inline box (including the root inline box)
to determine the extended block-progression dimension of the inline box.
The value of the 'line-box-contain' property determines how the
block-progression dimension and the extended block-progression dimension
affect the height of the line box.
The sum of the possible leading space and the block-progression dimension is called the <dfn>extended block-progression dimension</dfn>.
That extended value is not used for border, margin and padding placement but is used for vertical alignment (relative) and line box block-progression dimension.
</p>
<p>The <span class="index-def" title="leading"><em>leading</em></span><span title="leading">
for an inline non-replaced element
is defined as the d</span>ifference between the block-progression dimension as
determined by the 'text-height' property and the computed value
of
'line-height'. Half the leading is
called the <span class="index-def" title="half-leading"><em>
half-leading</em></span>, each half-leading is
located over and under the element.
The 'line-height' value
will specify the <em>exact</em> extended block-progression dimension of each box
generated by the element.
(Depending on the value of 'line-box-contain', the extended block-progression dimension may be ignored.)
(For inline
<a href="http://www.w3.org/TR/REC-CSS2/conform.html#replaced-element">replaced</a>
elements, both the block-progression dimension and the extended
block-progression dimension of the box are given by the
outer edges (i.e. margin edge).)
Anonymous inline boxes use the 'text-height' and
'line-height' property values specified for their parent.</p>
<p>Depending on the
value of the 'line-stacking-strategy', the 'line-height' value may provide a
minimum or exact extended block-progression dimension for each generated inline box and
the line boxes. How the leading space is distributed between the over-edge and
the under-edge of inline elements within the line box depends on their
vertical-align property value.
<span class="issue">[LDB: I don't understand this paragraph.]</span>
</p>
<p>Empty inline elements generate empty inline boxes, but these boxes still have
a line height, and thus may influence the line box block-progression dimension,
as if the empty box contained an infinitely narrow letter.</p>
<p>A inline box which otherwise would influence the line box extended
progression dimension may be removed from the computation by using a special
value of the line-height property: ''none''.</p>
<table class="propdef" id="name-62">
<tr>
<td><em>Name:</em>
<td><dfn id="line-height">line-height</dfn><tr>
<td><em>Value:</em>
<td>normal |
<a class="noxref" href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-number">
<span class="value-inst-number"><number></span></a> |
<a class="noxref" href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">
<span class="value-inst-length"><length></span></a> |
<a class="noxref" href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-percentage">
<span class="value-inst-percentage"><percentage></span></a> | none
<tr>
<td><em>Initial:</em>
<td>normal<tr>
<td><em>Applies to:</em>
<td>all elements<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>refer to the font size of the element itself <tr>
<td><em>Media:</em>
<td><a class="noxref"
href="/TR/REC-CSS2/media.html#visual-media-group">visual</a>
<tr>
<td><em>Computed value:</em>
<td>see prose</table>
<p>Values for this property have the following meanings:</p>
<dl>
<dt><strong>normal</strong> </dt>
<dd>Tells user agents to set the
<a href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">computed
value</a> to a "reasonable" value based on the font size of the element. The
value has the same meaning as <span class="index-inst" title="<number>">
<a class="noxref" href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-number" name="x18">
<span class="value-inst-number"><number></span></a></span>. We recommend a
computed value for ''normal'' between 1.0 to 1.2. The user agent may allow the
<number> to vary depending on the metrics of the font(s) being used.</dd>
<dt><span class="index-inst" title="<length>">
<a class="noxref" href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length" name="x19">
<span class="value-inst-length"><strong><length></strong></span></a></span>
</dt>
<dd>The box height is set to this length. Negative values are illegal. The
length is the computed value.</dd>
<dt><span class="index-inst" title="<number>">
<a class="noxref" href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-number" name="x20">
<span class="value-inst-number"><strong><number></strong></span></a></span>
</dt>
<dd>The <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">
computed value</a> of the property is this number multiplied by the element's
font size. Negative values are illegal. However, the number, not the
<a href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">computed
value</a>, is inherited. </dd>
<dt><span class="index-inst" title="<percentage>">
<a class="noxref" href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-percentage" name="x21">
<span class="value-inst-percentage"><strong><percentage></strong></span></a></span>
</dt>
<dd>The <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">
computed value</a> of the property is this percentage multiplied by the
element's computed font size. Negative values are illegal.</dd>
<dt>none</dt>
<dd>For inline-level elements, the element does not influence the <i>extended
block-progression dimension</i> of the line. The computed value is the
specified value (''none''). For block-level elements, equivalent to ''normal''
(and the computed value is ''normal'').
<span class="issue">This definition should be briefer, and should
refer to the next section.</span></dd>
</dl>
<div class="example">
<p style="DISPLAY: none">Example(s):</p>
<p>The three rules in the example below have the same resultant line height:
</p>
<pre>DIV { line-height: 1.2; font-size: 10pt } /* number */
DIV { line-height: 1.2em; font-size: 10pt } /* length */
DIV { line-height: 120%; font-size: 10pt } /* percentage */
</pre>
</div>
<p>When an element contains text that is rendered in more than one font, user
agents should determine the
'line-height' value according to
the largest font size (when appropriate). </p>
<p>Note that replaced elements have a
'font-size' and a
'line-height' property, even if
they are not used directly to determine the extended block-progression dimension of the box: ''em'' and ''ex''
values are relative to values of 'font-size' and percentage values for
'vertical-align' are relative
to values of the extended block-progression dimension. <span class="issue">[LDB: The second part of this sentence is a significant change from CSS2, and also doesn't mauke senes in the context of the sentence.]</span></p>
<p>When the
'line-height' value is less than
the font size, the final inline box extended block-progression dimension will be less than the font size and
the rendered glyphs will "bleed" outside the box. If such a box touches the edge
of a line box, the rendered glyphs will also "bleed" into the adjacent line box.</p>
<h4 id="LineStacking">Line Stacking: the
'line-box-contain' property</h4>
<table class="propdef" id="name-30">
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id="line-box-contain">line-box-contain</dfn>
<tr>
<td><em>Value:</em>
<td>[ block || inline || font || glyphs || replaced || inline-box ] | none |
inherit | initial
<tr>
<td><em>Initial:</em>
<td>block inline replaced
<tr>
<td><em>Applies to:</em>
<td>block-level elements
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>specified value (except for ''inherit'' and ''initial'')
</table>
<p>This property enumerates which aspects of the elements in a line box
contribute to the height height of that line box.
<dl>
<dt>block
<dd>The extended block progression dimension of the root inline box
must fit within the line box.
<dt>inline
<dd>The extended block progression dimension of all non-replaced
inline boxes whose 'line-height' is not ''none'' in the line box must fit within the line box.
<dt>font
<dd>The block progression dimension of all non-replaced inline boxes in
the line whose 'line-height' is not ''none'' that directly (i.e., within
the box but not within one of its descendants) contain non-removed text
must fit within the line box, where non-removed text is any characters
not removed based on the values of the 'white-space'. <span class="issue">[LDB: This isn't quite right. What about zwnj,
etc.?</span>
<dt>glyphs
<dd>The block progression dimension of all the glyph bounding boxes of
glyphs in the line box must fit within the line box.</dd>
<dt>replaced
<dd>The margin box of all <span title="replaced element"><a href="#replaced">replaced elements</a></span> within the line
must fit within the line box.
<dt>inline-box
<dd>The margin-box of all non-replaced inline elements in the line whose
'line-height' is not ''none'' must fit within the line box. <span class="issue">Should this split into inline-border and
inline-margin?</span>
</dl>
<p>If the property has no value for all elements within a line, then the line
box has 0 height, and the line within the anonymous inline established by the
block that coincides with the line block is the baseline of that anonymous
inline block (or should it be determined by the 'vertical-align' property of
the block?). <span class="issue">[This is arbitrary. Does anyone have better
ideas?]</span>
<p class="note">Note that the CSS2 model is equivalent to 'block inline
replaced' but the backwards-compatible HTML model is similar to (but not
exactly) 'font replaced' [1].
<p class="issue">Concerns: * How does this work with the cascade? * What
about determining the visual size of inline boxes?
<p class="issue">[1] I believe the differences are restricted to the first
line of LI elements, the last line of LI, DD, and DT elements, and issues
concerning whitespace around images. [DB]
<p>The height of each line box is established as follows (we describe the
case for <em><a href="#horizontal">horizontal flow</a></em>, but vertical
flow is analogous). First align all the boxes on the line relative to each
other according to the rules for 'vertical-align'. The line box must satisfy all of
the following constraints:
<ol>
<li>For each box on the line that has ''font'' in its
value of 'line-box-contain', the line box must be
high enough to contain the <span title="top of the text"><a href="#top-of">top and bottom of that box's text</a></span>.
<li>For each box that has ''inline'' in 'line-box-contain', the top of the line
box must be at least as high as the <span title="top of the text"><a href="#top-of">top of the box's text</a></span> plus the box's <em><a href="#half-leading">half-leading</a></em>. The bottom of the line box must
be at least as low as the bottom of the text plus the half-leading.
<li>For each box that has ''inline-box'' in 'line-box-contain',
the top of the line box must be at least as high as the margin-top of this
box. The bottom of the line box must be at least as low as the margin-bottom.
<li>For each <em>replaced box</em> that has ''replaced'' in its 'line-box-contain', the line box must
contain the margin-top and margin-bottom of this box. <span class="issue">[The value ''replaced'' is not strictly needed. ''Inline-box'' also
does the job, except that it is not automatically restricted to replaced
elements.]</span>
<li>For each box that has ''glyphs'' in 'line-box-contain',
the top of the line box must be at least as high as the top of each glyph in
the box (excluding those in child elements). The bottom of the line box must
be at least as low as the bottom of each glyph in the box (excluding child
elements).
<li>If the enclosing block for this line has
''block'' in 'line-box-contain', then the top of the line box
must be at least as high as the text top plus the half-leading of an
<em><a href="#anonymous">anonymous inline element</a></em> and the bottom of
the line box as low as the text bottom plus the half leading. This must hold
whether or not this line actually contains such an element.
</ol>
<p class="note">Thus ''block'' can be used to set an overall minimum line
height (viz. the value of 'line-height' of the element itself) for all lines
in an element, independent of the actual contents of each line. In
particular, setting 'line-box-contain' to just ''block'' and no other values
will ensure that all lines are the same height, at the possible risk of some
tall inline elements overlapping with lines above or below.
<p>The <dfn id="half-leading">half-leading</dfn> of a box is defined as half
the computed value of 'line-height' minus half the computed value of
'font-size', i.e., (line-height - font-size)/2.
<p>The <dfn id="top-of">top of the text</dfn> is the top of the em-box of a
box's nominal font, whether or not there actually is any letter that tall.
Replaced elements, for example, have no text, but still have a nominal font
and are thus a text top. The rules above refer to the position of the text
top after the box has been aligned with 'vertical-align'.
<h5 id="old-remove-this">Old, remove this:</h5>
<p>Line stacking is the mechanism by which a line box is determined for each
line in a block and then these lines are stacked in the block-progression
direction resolving any spacing constraints between adjacent lines. The
line-stacking strategy covers both the determination of the block-progression
dimension (height in horizontal flow) of a line box and the rules for spacing
line boxes.</p>
<p>All line stacking strategies make use of the properties: 'font-size',
'text-height' and 'line-height'.</p>
<p>The line stacking properties are made of the following properties:</p>
<ol>
<li>The 'line-stacking-strategy' property determines the overall stacking
method,</li>
<li>The 'line-stacking-ruby' property determines how elements with
'display=ruby' are stacked,</li>
<li>The 'line-stacking-shift' property determines how elements which are
baseline-shifted are stacked,</li>
<li>Finally the 'line-stacking' property is a short-hand for the previous
properties.</li>
</ol>
<table class="propdef" id="name-162">
<tr>
<td><em>Name:</em>
<td><dfn id="line-stacking-strategy">line-stacking-strategy</dfn>
<tr>
<td><em>Value:</em>
<td>inline-line-height | block-line-height | max-height | grid-height
<tr>
<td><em>Initial:</em>
<td>inline-line-height<tr>
<td><em>Applies to:</em>
<td>block-level elements
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>N/A<tr>
<td><em>Media:</em>
<td><a class="noxref"
href="/TR/REC-CSS2/media.html#visual-media-group">visual</a>
<tr>
<td><em>Computed value:</em>
<td>specified value (except for initial and inherit)</table>
<p>This property determines the line stacking strategy for stacked line boxes
within a containing block element. The term <dfn>stack-height</dfn> is used in the
context of this property description to indicate the block-progression dimension
for the line boxes. Possible values:
<dl>
<dt><strong>inline-line-height</strong>
<dd>The <i>stack-height</i> is the smallest value that contains the <i>extended
block-progression dimension</i> of all the inline elements on that line when those
elements are properly aligned. Since the line spacing information is already
included in the computation of the line box, these line boxes are simply stacked
adjacent to one another in the formatted block to which they belong. The
'line-height' property value is taken into account for both the inline elements
and the block elements. For inline elements, it defines the extended
block-progression dimension. For block elements, it defines the
<i>minimum extended block-progression dimension</i>.
<dt>block-line-height</dt>
<dd>The <i>stack-height</i> is determined by the block element computed 'line-height' property
value. The 'line-height' property value is ignored for inline elements. For
alignment purpose, this case is similar to the
<i>minimum extended block-progression dimension</i> case (strut model).
This is the only line-stacking strategy that may cause inline boxes within the line
to bleed over and under the line box because the line box is not constrained by its inline boxes.
If the block computed 'line-height' is ''none'', the stack-height is determined as if
'line-height: normal'.</dd>
<dt>max-height</dt>
<dd>The <i>stack-height</i> is the smallest value that contains the
block-progression dimension of all the inline elements on that line when those
elements are properly aligned. The 'line-height' property value is taken into
account only for the block elements and it defines the
<dfn>minimum extended block-progression dimension</dfn>.</dd>
<dt>grid-height</dt>
<dd>The <i>stack-height</i> is the smallest multiple of the block element 'line-height'
computed value that can contain the block-progression of all the inline
elements on that line when those elements are properly aligned. The
'line-height' property value is ignored for inline elements. If the block
computed 'line-height' is ''none'', the stack-height is determined as if
'line-height: normal'.</dd>
</dl>
<p>When the line-stack strategy dictates that the inline element line-height be
ignored, this means that for those elements only their block-progression
dimensions are considered for the <i>stack-height</i>, not their extended
block-progression dimensions.</p>
<p class="note"><b>Note.</b> XSL has a similar property with the same name which
use different but equivalent values: 'line-height' instead of
''inline-line-height'', ''font-height'' instead of ''block-line-height''. It also uses
''max-height''. The value ''grid-height'' is new to the CSS3 property.<p> <table class="propdef" id="name-60">
<tr>
<td><em>Name:</em>
<td><dfn id="line-stacking-ruby">line-stacking-ruby</dfn><tr>
<td><em>Value:</em>
<td>exclude-ruby | include-ruby
<tr>
<td><em>Initial:</em>
<td>exclude-ruby<tr>
<td><em>Applies to:</em>
<td>block-level elements
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>N/A<tr>
<td><em>Media:</em>
<td><a class="noxref"
href="/TR/REC-CSS2/media.html#visual-media-group">visual</a>
<tr>
<td><em>Computed value:</em>
<td>specified value (except for initial and inherit)</table>
<p>This property determines the line stacking method for block elements
containing ruby annotation elements (element with 'display: ruby-text' or
'display: ruby-text-container'). In all cases the ruby base elements (elements
with 'display: ruby-base' or display: ruby-base-container') are considered for
line stacking. Possible values:<dl>
<dt><strong>exclude-ruby</strong>
<dd>The ruby annotation elements are ignored for line stacking.<dt>include-ruby</dt>
<dd>The ruby annotation elements are considered for line stacking.</dd>
</dl>
<p>This property is ignored in two cases:<ol>
<li>The element text-height property is set to ''max-size''.</li>
<li>The line stacking strategy is set to ''block-line-height''.</li>
</ol>
<table class="propdef" id="name-160">
<tr>
<td><em>Name:</em>
<td><dfn id="line-stacking-shift">line-stacking-shift</dfn><tr>
<td><em>Value:</em>
<td>consider-shifts | disregard-shifts<tr>
<td><em>Initial:</em>
<td>consider-shifts<tr>
<td><em>Applies to:</em>
<td>block-level elements
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>N/A<tr>
<td><em>Media:</em>
<td><a class="noxref"
href="/TR/REC-CSS2/media.html#visual-media-group">visual</a>
<tr>
<td><em>Computed value:</em>
<td>specified value (except for initial and inherit)</table>
<p>This property determines the line stacking method for block elements
containing elements with baseline-shift. Possible values:<dl>
<dt><strong>consider-shifts</strong>
<dd>In determining the <i>stack-height</i>, include the adjusted top-edge and
bottom-edge of any characters that have a baseline-shift.
<dt>disregard-shifts</dt>
<dd>In determining the <i>stack-height</i>, include the unshifted top-edge and
bottom-edge of any characters that have a baseline-shift. </dd>
</dl>
<p>This property is ignored in two cases:<ol>
<li>The element text-height property is set to ''max-size''.</li>
<li>The line stacking strategy is set to ''block-line-height''.</li>
</ol>
<p class="note"><b>Note.</b> XSL has a similar property with a different name:
'line-height-shift-adjustment' which use the same values.<p>Finally, the line
stacking strategy can be used using the following shorthand:</p>
<table class="propdef" id="name-260">
<tr>
<td><em>Name:</em>
<td><dfn id="line-stacking">line-stacking</dfn><tr>
<td><em>Value:</em>
<td><'line-stacking-strategy'> || <'line-stacking-ruby'> ||
<'line-stacking-shift'><tr>
<td><em>Initial:</em>
<td>see individual properties<tr>
<td><em>Applies to:</em>
<td>block-level elements
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>N/A<tr>
<td><em>Media:</em>
<td><a class="noxref"
href="/TR/REC-CSS2/media.html#visual-media-group">visual</a>
<tr>
<td><em>Computed value:</em>
<td>see individual properties</table>
<h2 id="baseline">Baseline alignment</h2>
<p>Baseline alignment describes the alignment of textual content and based on
information contained in font tables associated with font resources.
Additional descriptions for these font tables are provided in thea href="http://www.w3.org/Style/Group/css3-src/css3-fonts/Overview.html">CSS3
Fonts module</a>.
<h3 id="FontBaseline">Baseline information
provided by fonts</h3>
<p>The glyphs of a given script are positioned so that a particular point on
each glyph, the <dfn>alignment-point</dfn>, is aligned with the alignment-points of
the other glyphs in that script. The glyphs of different scripts are typically
aligned at different points on the glyph. For example, Western
glyphs are aligned on the bottoms of the capital letters, certain Indic
glyphs (including glyphs from the Devanagari, Gurmukhi and Bengali scripts)
are aligned at the top of a horizontal stroke near the top of the glyphs and
East Asian glyphs are aligned either at the bottom or center of the EM box of
the glyph. Within a script and within a line of text having a single
font-size, the sequence of alignment-points defines, in the
inline-progression-direction, a geometric line called a <dfn>baseline</dfn>.
Western and most other alphabetic and syllabic glyphs are aligned to an
"alphabetic" baseline, the above Indic glyphs are aligned to a "hanging"
baseline and the East Asian glyphs are aligned to an "ideographic" baseline.
<div class="figure">
<p><img alt="three alignment points" height="89"
src="AlignmentPointsMixedScripts2.gif" width="457">
<p>This figure shows the vertical position of the alignment-point for
alphabetic and many syllabic scripts, illustrated by a Roman "A"; for certain
Indic scripts, illustrated by a Gurmukhi syllable “ji”; and for ideographic
scripts, illustrated by the ideographic glyph meaning "country". The thin
black rectangle around the ideographic glyph illustrates the EM box for that
glyph and shows the typical positioning of the "black marks" of the glyph
within the EM box.
</div>
<p>A <dfn>baseline-table</dfn> specifies the position of one or more baselines in
the design space coordinate system. The function of the baseline table is to
facilitate the alignment of different scripts with respect to each other when
they are mixed on the same text line. Because the desired relative alignments
may depend on which script is dominant in a line (or block), there may be a
different baseline table for each script. In addition, different alignment
positions are needed for horizontal and vertical writing modes. Therefore,
the font may have a set of baseline tables: typically, one or more for
horizontal writing-modes and zero or more for vertical writing-modes.
<div class="figure">
<p><img alt="different baseline positions" height="473"
src="Baselines-HorizAndVert-ApCountry.gif" width="475">
<p>Examples of horizontal and vertical baseline positions. The thin lined box
in each example is the "EM box". For the Latin glyphs, only the EM box of the
first glyph is shown. Example 1 shows typical Latin text written
horizontally. This text is positioned relative to the alphabetic baseline,
shown in blue. Example 2 shows a typical ideographic glyph positioned on the
horizontal ideographic baseline. Note that the EM Box is positioned
differently for these two cases. Examples 3 and 4 show the same set of
baselines used in vertical writing. The Latin text, example 3, is shown with
a glyph-orientation of 90 degrees which is typical for proportionally space
Latin glyphs in vertical writing. Even though the ideographic glyph in
Example 4 is positioned on the vertical ideographic baseline, because it is
centered in the EM box, all glyphs with the same EM Box are centered,
vertically, with respect to one another.
</div>
<p>The font tables for a font include font characteristics for the individual
glyphs in the font. CSS assumes that the font tables include, for each glyph
in the font, one width value, one alignment-baseline and one alignment-point
for the horizontal writing-modes. If vertical writing-modes are supported,
then each glyph must have another width value, alignment-baseline and
alignment-point for the vertical writing-modes. (Even though it is specified
as a width, for vertical writing-modes the width is used in the vertical
direction.)
<p>The script to which a glyph belongs determines an alignment-baseline to
which the glyph is to be aligned. The position of this baseline in the design
space coordinate system determines the default block-progression direction
position of the alignment-point. The inline-progression direction position of
the alignment-point is on the start-edge of the glyph.
<div class="figure">
<p><img alt="alignment in em box" height="110"
src="AlignmentPointsMixedScriptsOnBaselines.gif" width="458">
<p>This figure shows glyphs from three different scripts, each with its EM
box and within the EM box, the baseline table applicable to that glyph. The
alignment-point of each glyph is shown by an "X" on the start edge of the EM
box and by making alignment-baseline blue. The baseline-table of the parent
element of the characters that mapped to these glyphs is shown as a set of
dashed lines.
</div>
<h3 id="AlignmentBaselineType">Baseline
identifiers</h3>
<p>The baseline alignment properties control the alignment of child element
with respect to their parent. The positions of these baselines are
illustrated in the following figure:
<div class="figure">
<p><img alt="different baselines" height="102" src="Baselines-rev.gif"
width="587">
<p>This figure shows samples of Gurmukhi (a hanging Indic script), Latin and
ideographic scripts together with most of the baselines defined below. The
thin line around the ideographic glyphs symbolizes the EM box in which these
glyphs are centered. In this figure, the position of the "text-over-edge"
and "text-under-edge" baselines is computed assuming that the "alphabetic"
baseline is the dominant-baseline. The "central" baseline has been omitted
from the figure, but it lies halfway between the "text-over-edge" and
"text-under-edge" baselines, just about where the "math" baseline is shown.
</div>
<p>The baseline-identifiers below are used in this specification. Some of
these are determined by baseline-tables contained in a font as described in
the section describing the <a href="#FontBaseline">baseline information
provided by fonts</a>. Others are computed from other font characteristics as
described below. Whether determined by the font or computed, a derived
baseline-table is constructed with positions of each of the baselines below.
<dl>
<dt><dfn>alphabetic</dfn>
<dd>
<p>This identifies the baseline used by most alphabetic and syllabic scripts.
These include, but are not limited to, many Western, Southern Indic,
Southeast Asian (non-ideographic) scripts.
<dt><dfn>ideographic</dfn>
<dd>
<p>This identifies the baseline used by ideographic scripts. For historical
reasons, this baseline is at the bottom of the ideographic EM box and not in
the center of the ideographic EM box. See the "central" baseline. The
ideographic scripts include Chinese, Japanese, Korean, and Vietnamese Chu
Nom.
<dt><dfn>hanging</dfn>
<dd>
<p>This identifies the baseline used by certain Indic scripts. These scripts
include Devanagari, Gurmukhi and Bengali.
<dt><dfn>mathematical</dfn>
<dd>
<p>This identifies the baseline used by mathematical symbols.
<dt><dfn>central</dfn>
<dd>
<p>This identifies a computed baseline that is at the center of the EM box.
This baseline lies halfway between the text-over-edge and text-under-edge
baselines.
<p class="note">Note. For ideographic fonts, this baseline is often used to