forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
executable file
·4988 lines (3680 loc) · 183 KB
/
Overview.html
File metadata and controls
executable file
·4988 lines (3680 loc) · 183 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head><meta content="text/html;charset=utf-8" http-equiv=Content-Type>
<title>CSS Line Layout Module Level 3</title>
<!--
FIXME when publishing: copy the current default.css and link to
"default.css" rather than "../default.css"
-->
<link href="../default.css" rel=stylesheet type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style type="text/css">
dt {font-weight: normal}
/*.issue, .note {font-style: italic}*/
.figure {font-size: smaller;}
/* Stolen from CSS2 Recommendation */
A.noxref:link, A.noxref:visited {color: black; /*color: inherit*/}
</style>
<style media=print type="text/css">
img#edge { width: 80%; height: 70%;}
dt.label { display: run-in; }
</style>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Line Layout Module Level 3</h1>
<h2 class="no-num no-toc" id=editors>Editor's Draft 2 March 2012</h2>
<dl id=authors>
<dt>This version:
<dd><a
href="http://dev.w3.org/csswg/css3-linebox/">http://dev.w3.org/csswg/css3-linebox/</a>
<!-- <dd><a href="http://www.w3.org/TR/2012/ED-css3-linebox-20120302/">http://www.w3.org/TR/2012/ED-css3-linebox-20120302/</a> -->
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-linebox/">http://www.w3.org/TR/css3-linebox/</a>
<dt>Latest editor's draft:
<dd><a
href="http://dev.w3.org/csswg/css3-linebox/">http://dev.w3.org/csswg/css3-linebox/</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2002/WD-css3-linebox-20020515/">http://www.w3.org/TR/2002/WD-css3-linebox-20020515/</a>
<dt>Issues List:
<dd><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>
<dt>Discussion:
<dd><a
href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
with subject line “<kbd>[css3-linebox] topic</kbd>”
<dt>Editors:
<dd><a href="mailto:jdaggett@mozilla.com">John Daggett (Mozilla)</a>
<dd><a href="mailto:szilles@adobe.com">Steve Zilles (Adobe)</a>
<dt>Previous Editors:
<dd><a href="http://dbaron.org/">L. David Baron</a> (Mozilla Corporation)
<dd>Michel Suignard (Microsoft)
<dd><a href="http://www.meyerweb.com/eric/">Eric A. Meyer</a>
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2012 <a href="http://www.w3.org/"><acronym
title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym
title="European Research Consortium for Informatics and
Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<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 href="#CSS3TEXT"
rel=biblioentry>[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 href="#CSS2"
rel=biblioentry>[CSS2]<!--{{CSS2}}--></a>.
<h2 class="no-num no-toc" id=Status>Status of This Document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-linebox%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
discussion of this specification. When sending e-mail, please put the text
“css3-linebox” in the subject, preferably like this:
“[<!---->css3-linebox<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/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="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<p>This document may be available in translations in the future. The
English version of this specification is the only normative version.
<h2 class="no-num no-toc" id=Contents>Contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#dependencies"><span class=secno>1 </span>Dependencies on
other modules</a>
<li><a href="#conformance"><span class=secno>2 </span>Conformance</a>
<li><a href="#LineBox"><span class=secno>3 </span>Line box, Line stacking
and Content height</a>
<ul class=toc>
<li><a href="#InlineFormatting"><span class=secno>3.1 </span>Inline
formatting context</a>
<li><a href="#LineBoxWrapping"><span class=secno>3.2
</span>Inline-progression: Line Box wrapping</a>
<li><a href="#inline1"><span class=secno>3.3 </span>Block-progression
dimensions: the <span class=property>‘<code
class=property>text-height</code>’</span> property</a>
<li><a href="#LineBoxHeight"><span class=secno>3.4 </span>Block
progression positioning and spacing</a>
<ul class=toc>
<li><a href="#InlineBoxHeight"><span class=secno>3.4.1 </span>Line
height adjustment: the <span class=property>‘<code
class=property>line-height</code>’</span> property</a>
<li><a href="#LineStacking"><span class=secno>3.4.2 </span>Line
Stacking: the <span class=property>‘<code
class=property>line-box-contain</code>’</span> property</a>
</ul>
</ul>
<li><a href="#baseline"><span class=secno>4 </span>Baseline alignment</a>
<ul class=toc>
<li><a href="#FontBaseline"><span class=secno>4.1 </span>Baseline
information provided by fonts</a>
<li><a href="#AlignmentBaselineType"><span class=secno>4.2
</span>Baseline identifiers</a>
<li><a href="#BaselineAlignmentOverview"><span class=secno>4.3
</span>Overview of the baseline alignment process</a>
<li><a href="#dominant-baseline-prop"><span class=secno>4.4
</span>Dominant baseline: the <span class=property>‘<code
class=property>dominant-baseline</code>’</span> property</a>
<li><a href="#alignment-baseline-prop"><span class=secno>4.5
</span>Aligning the alignment point of an element: the <span
class=property>‘<code
class=property>alignment-baseline</code>’</span> property</a>
<li><a href="#alignment-adjust-prop"><span class=secno>4.6
</span>Setting the alignment point: the <span class=property>‘<code
class=property>alignment-adjust</code>’</span> property</a>
<li><a href="#baseline-shift-prop"><span class=secno>4.7
</span>Repositioning the dominant baseline: the <span
class=property>‘<code class=property>baseline-shift</code>’</span>
property</a>
<li><a href="#vertical-align-prop"><span class=secno>4.8 </span>Vertical
alignment: the <span class=property>‘<code
class=property>vertical-align</code>’</span> shorthand baseline
alignment property</a>
<li><a href="#inline-box-align-prop"><span class=secno>4.9 </span>Inline
box alignment: the <span class=property>‘<code
class=property>inline-box-align</code>’</span> property</a>
</ul>
<li><a href="#Initial"><span class=secno>5 </span>Initial line and Drop
initial</a>
<ul class=toc>
<li><a href="#InitialLine"><span class=secno>5.1 </span>Initial line</a>
<li><a href="#DropInitial"><span class=secno>5.2 </span>Drop Initial
overview</a>
<li><a href="#DropInitialSize"><span class=secno>5.3 </span>Sizing drop
initial, the <span class=property>‘<code
class=property>drop-initial-size</code>’</span> and the <span
class=property>‘<code
class=property>drop-initial-value</code>’</span> properties</a>
<li><a href="#DropInitialAlign"><span class=secno>5.4 </span>Aligning
drop initial: the <span class=property>‘<code
class=property>drop-initial-before-align</code>’</span>, <span
class=property>‘<code
class=property>drop-initial-before-adjust</code>’</span>, <span
class=property>‘<code
class=property>drop-initial-after-align</code>’</span> and <span
class=property>‘<code
class=property>drop-initial-after-adjust</code>’</span>
properties</a>
</ul>
<li><a href="#properties"><span class=secno>6 </span>Properties index</a>
<li><a href="#profiles"><span class=secno>7 </span>Profiles</a>
<li><a href="#glossary"><span class=secno>8 </span>Glossary</a>
<li class=no-num><a href="#BaselineUsage">Appendix A: Usage of baseline
alignment (informative)</a>
<li class=no-num><a href="#ack">Acknowledgments</a>
<li class=no-num><a href="#ref">References</a>
<ul class=toc>
<li class=no-num><a href="#normative">Normative references</a>
<li class=no-num><a href="#other">Other references</a>
</ul>
<li class=no-num><a href="#index">Index</a>
</ul>
<!--end-toc-->
<h2 id=dependencies><span class=secno>1 </span>Dependencies on other
modules</h2>
<p>This CSS3 module depends on the following other CSS3 modules:
<ul>
<li>Fonts <a href="#CSS3-FONTS"
rel=biblioentry>[CSS3-FONTS]<!--{{!CSS3-FONTS}}--></a>
<li>Text <a href="#CSS3TEXT"
rel=biblioentry>[CSS3TEXT]<!--{{!CSS3TEXT}}--></a>
<li>Syntax and grammar <a href="#CSS3SYN"
rel=biblioentry>[CSS3SYN]<!--{{!CSS3SYN}}--></a>
<li>Values and units <a href="#CSS3VAL"
rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a>
<li>Cascade <a href="#CSS3CASCADE"
rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>
</ul>
<p>It has non-normative (informative) references to the following other
CSS3 modules:
<ul>
<li>Multi-column layout <a href="#CSS3COL"
rel=biblioentry>[CSS3COL]<!--{{CSS3COL}}--></a>
<li>Ruby <a href="#CSS3RUBY"
rel=biblioentry>[CSS3RUBY]<!--{{CSS3RUBY}}--></a>
</ul>
<h2 id=conformance><span class=secno>2 </span>Conformance</h2>
<p class=issue>[Add some real conformance text here.]
<p>All described properties, in addition to the noted values, take ‘<code
class=property>initial</code>’ and ‘<code
class=property>inherit</code>’. These values are not repeated in each of
the property value enumeration.
<p>This module uses extensively the ‘<code
class=property>before</code>’, ‘<code class=property>after</code>’,
‘<code class=property>start</code>’ and ‘<code
class=property>end</code>’ notation to specify the four edges of a box
relative to its text advance direction, independently of its absolute
positioning in terms of ‘<code class=property>top</code>’, ‘<code
class=property>bottom</code>’, ‘<code class=property>left</code>’
and ‘<code class=property>right</code>’ (corresponding respectively to
the ‘<code class=property>before</code>’, ‘<code
class=property>after</code>’, ‘<code class=property>start</code>’
and ‘<code class=property>end</code>’ positions in a typical Western
text layout). This notation is also used extensively in <a href="#XSL10"
rel=biblioentry>[XSL10]<!--{{XSL10}}--></a> for the same purpose.
<p>Finally, in this document, requirements are expressed using the key
words "MUST", "MUST NOT", "REQUIRED",
"SHALL" and "SHALL NOT". Recommendations are expressed
using the key words "SHOULD", "SHOULD NOT" and
"RECOMMENDED". "MAY" and "OPTIONAL" are used
to indicate optional features or behavior. These keywords are used in
accordance with <a href="#RFC2119"
rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>. For legibility these
keywords are used in lowercase form.
<h2 id=LineBox><span class=secno>3 </span>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><span class=secno>3.1 </span>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
after-edges or before-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 <a class=index-def href="#line-box0" id=x
title="line box"> </a><a id=line-box><dfn id=line-box0>line box</dfn></a>.
<p>The inline-progression dimension (‘<code
class=property>width</code>’ in horizontal flow) of a line box is
determined by its containing block. The block-progression dimension
(‘<code class=property>height</code>’ 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>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>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 <span class=property>‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’</span> property.
<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
<span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span>), 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>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).
<h3 id=LineBoxWrapping><span class=secno>3.2 </span>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>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 <span class=property>‘<code class=property><a
href="#text-align">text-align</a></code>’</span> property. If that
property has the value ‘<code class=property>justify</code>’, the user
agent may stretch the inline boxes as well.
<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>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>.
<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>EM: "emphasized words"
<li>Anonymous: "appear"
<li>STRONG: "in this"
<li>Anonymous: "sentence, dear."
</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.
<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." height=99
src=inline-layout.gif width=260><span class=dlink> <a
href="http://www.w3.org/TR/REC-CSS2/images/longdesc/inline-layout-desc.html"
name=img-inline-layout title="Long description for illustration of
margin/border behavior on split inline box">[D]</a></span></div>
<ul>
<li>The margin is inserted before "emphasized" and after
"words".
<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.
</ul>
</div>
<h3 id=inline1><span class=secno>3.3 </span>Block-progression dimensions:
the <span class=property>‘<code class=property><a
href="#text-height">text-height</a></code>’</span> property</h3>
<p>Each inline box has a block-progression dimension which is derived from
the following parameters: the ‘<code class=property><a
href="#text-height">text-height</a></code>’ and ‘<code
class=property><a href="#font-size">font-size</a></code>’ 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>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 ‘<code
class=property><a href="#line-box-contain">line-box-contain</a></code>’
property.
<table class=propdef id=nametext-height>
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=text-height>text-height</dfn>
<tr>
<td><em>Value:</em>
<td>auto | font-size | text-size | max-size | <number>
<tr>
<td><em>Initial:</em>
<td>auto
<tr>
<td><em>Applies to:</em>
<td>inline elements and parents of element with display:ruby-text
<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 initial and inherit)
</table>
<p>The ‘<code class=property><a
href="#text-height">text-height</a></code>’ property determine the
block-progression dimension of the text content area of an inline box
(non-replaced elements) . Possible values:
<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
<dd>The block-progression dimension is based on the em square as
determined by the computed element font-size.
<dt>text-size
<dd>The block-progression dimension is based on the cell-height (ascender
+ descender) related to the computed element font-size.
<dt>max-size
<dd>The block-progression dimension is based on the maximum extents toward
the before-edge and after-edge of the box obtained by considering all
children elements located on the same line, ruby annotations (elements
with ‘<code class=css>display:ruby-text</code>’) and baseline shifted
elements.
<dt><number>
<dd>The block progression dimension is based on <number> times the
em square as determined by the computed font-size.
</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>Although the ‘<code class=property><a
href="#text-height">text-height</a></code>’ property does not apply
directly to block elements, it applies to their anonymous children inline
boxes (if any).
<p>For replaced elements, the block-progression dimension is determined by
the outer edges (i.e. margin edge).
<h3 id=LineBoxHeight><span class=secno>3.4 </span>Block progression
positioning and spacing</h3>
<h4 id=InlineBoxHeight><span class=secno>3.4.1 </span>Line height
adjustment: the <span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span> property</h4>
<p>The ‘<code class=property><a
href="#line-height">line-height</a></code>’ property controls the amount
of leading space which is added before and after the block-progression
dimension of an inline box (not including replaced inline boxes, but
including the root inline box) to determine the extended block-progression
dimension of the inline box. The value of the ‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’ 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 <b>extended block-progression dimension</b>. 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>The <span class=index-def id=leading title=leading><em><a
name=x15>leading</a></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 ‘<code
class=property><a href="#text-height">text-height</a></code>’ property
and the computed value of <span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span>. Half the leading is
called the <a class=index-def href="#half-leading" id=half-leading0
title=half-leading><em><a name=x16> half-leading</a></em></a>, each
half-leading is located before and after the block-progression dimension
of the element. The ‘<code class=property><a
href="#line-height">line-height</a></code>’ value will specify the
<em>exact</em> extended block-progression dimension of each box generated
by the element. (Depending on the value of ‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’, 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 ‘<code class=property><a
href="#text-height">text-height</a></code>’ and ‘<code
class=property><a href="#line-height">line-height</a></code>’ property
values specified for their parent.
<p>Depending on the value of the ‘<code class=property><a
href="#line-stacking-strategy">line-stacking-strategy</a></code>’, the
‘<code class=property><a href="#line-height">line-height</a></code>’
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 before-edge and the after-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>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>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: ‘<code
class=property>none</code>’.
<table class=propdef id=name-62>
<tbody>
<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:
<dl>
<dt><strong>normal</strong>
<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
id=ltnumbergt 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 ‘<code
class=property>normal</code>’ 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.
<dt><span class=index-inst id=ltlengthgt0 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>
<dd>The box height is set to this length. Negative values are illegal. The
length is the computed value.
<dt><span class=index-inst id=ltnumbergt0 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>
<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.
<dt><span class=index-inst id=ltpercentagegt0 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>
<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.
<dt>none
<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 (‘<code class=property>none</code>’).
For block-level elements, equivalent to ‘<code
class=property>normal</code>’ (and the computed value is ‘<code
class=property>normal</code>’). <span class=issue>This definition
should be briefer, and should refer to the next section.</span>
</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 <span class=property>‘<code
class=property><a href="#line-height">line-height</a></code>’</span>
value according to the largest font size (when appropriate).
<p>Note that replaced elements have a <span class=property>‘<code
class=property><a href="#font-size">font-size</a></code>’</span> and a
<span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span> property, even if
they are not used directly to determine the extended block-progression
dimension of the box: ‘<code class=property>em</code>’ and ‘<code
class=property>ex</code>’ values are relative to values of ‘<code
class=property><a href="#font-size">font-size</a></code>’ and percentage
values for <span class=property>‘<code class=property><a
href="#vertical-align">vertical-align</a></code>’</span> 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>When the <span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span> 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.
<h4 id=LineStacking><span class=secno>3.4.2 </span>Line Stacking: the <span
class=property>‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’</span> 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 ‘<code
class=property>inherit</code>’ and ‘<code
class=property>initial</code>’)
</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 ‘<code class=property><a
href="#line-height">line-height</a></code>’ is not ‘<code
class=property>none</code>’ 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 ‘<code class=property><a
href="#line-height">line-height</a></code>’ is not ‘<code
class=property>none</code>’ 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 ‘<code
class=property>linefeed-treatment</code>’, ‘<code
class=property>white-space-treatment</code>’, and ‘<code
class=property>all-space-treatment</code>’ properties. <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.
<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
‘<code class=property><a href="#line-height">line-height</a></code>’
is not ‘<code class=property>none</code>’ must fit within the line
box. <span class=issue>Should this split into ‘<code
class=property>inline-border</code>’ and ‘<code
class=property>inline-margin</code>’?</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
‘<code class=property><a
href="#vertical-align">vertical-align</a></code>’ 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 ‘<code
class=css>block inline replaced</code>’ but the backwards-compatible
HTML model is similar to (but not exactly) ‘<code class=css>font