-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathvisuren.html
2627 lines (2302 loc) · 116 KB
/
visuren.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 PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>Visual formatting model</title>
<link rel="stylesheet" href="style/default.css" type="text/css">
<link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED.css" type="text/css">
<link rel="prev" href="box.html">
<link rel="next" href="visudet.html">
<link rel="contents" href="cover.html#minitoc">
<link rel="CSS-properties" href="propidx.html" title="properties">
<link rel="index" href="indexlist.html" title="index">
<link rel="first" href="cover.html">
<style type="text/css">
.current,.proposed,span.delcurrent { background:#feb }
ins.proposed,span.insproposed,li.insproposed { background:#bfb }
del.proposed,span.delproposed { background:#fbb }
span.insproposed,li.insproposed { text-decoration:underline }
span.delproposed,span.delcurrent { text-decoration:line-through }
body>del,body>ins {display:block}
blockquote.math {display: table}
blockquote.math p {display: table-row}
blockquote.math span {display: table-cell; padding-right: 0.3em}
blockquote.math span:first-child {text-align: right}
</style>
</head>
<body>
<div class="navbar">
<p><a href="box.html">previous</a>
<a href="visudet.html">next</a>
<a href="cover.html#minitoc">contents</a>
<a href="propidx.html">properties</a>
<a href="indexlist.html">index</a>
</div>
<hr class="navbar">
<h1><span id="q9.0"><a name="q0">9 Visual formatting model</a></span></h1>
<div class="subtoc">
<p><strong>Contents</strong>
<ul class="toc">
<li class="tocline2"><a href="visuren.html#visual-model-intro" class="tocxref">9.1 Introduction to the visual formatting model</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#viewport" class="tocxref">9.1.1 The viewport</a>
<li class="tocline3"><a href="visuren.html#containing-block" class="tocxref">9.1.2 <span class="index-def" title="containing block"> Containing blocks</span></a>
</ul>
<li class="tocline2"><a href="visuren.html#box-gen" class="tocxref">9.2 Controlling box generation</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#block-boxes" class="tocxref">9.2.1 Block-level elements and block boxes</a>
<ul class="toc">
<li class="tocline4"><a href="visuren.html#anonymous-block-level" class="tocxref">9.2.1.1 Anonymous block boxes</a>
</ul>
<li class="tocline3"><a href="visuren.html#inline-boxes" class="tocxref">9.2.2 Inline-level elements and inline boxes</a>
<ul class="toc">
<li class="tocline4"><a href="visuren.html#anonymous" class="tocxref">9.2.2.1 Anonymous inline boxes</a>
</ul>
<li class="tocline3"><a href="visuren.html#run-in" class="tocxref">9.2.3 Run-in boxes</a>
<li class="tocline3"><a href="visuren.html#display-prop" class="tocxref">9.2.4 The <span class="propinst-display">'display'</span> property</a>
</ul>
<li class="tocline2"><a href="visuren.html#positioning-scheme" class="tocxref">9.3 Positioning schemes</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#choose-position" class="tocxref">9.3.1 Choosing a positioning scheme: <span class="propinst-position">'position'</span> property</a>
<li class="tocline3"><a href="visuren.html#position-props" class="tocxref">9.3.2 Box offsets: <span class="propinst-top">'top'</span>, <span class="propinst-right">'right'</span>, <span class="propinst-bottom">'bottom'</span>, <span class="propinst-left">'left'</span></a>
</ul>
<li class="tocline2"><a href="visuren.html#normal-flow" class="tocxref">9.4 Normal flow</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#block-formatting" class="tocxref">9.4.1 Block formatting contexts</a>
<li class="tocline3"><a href="visuren.html#inline-formatting" class="tocxref">9.4.2 Inline formatting contexts</a>
<li class="tocline3"><a href="visuren.html#relative-positioning" class="tocxref">9.4.3 Relative positioning</a>
</ul>
<li class="tocline2"><a href="visuren.html#floats" class="tocxref">9.5 Floats</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#float-position" class="tocxref">9.5.1 Positioning the float: the <span class="propinst-float">'float'</span> property</a>
<li class="tocline3"><a href="visuren.html#flow-control" class="tocxref">9.5.2 Controlling flow next to floats: the <span class="propinst-clear">'clear'</span> property</a>
</ul>
<li class="tocline2"><a href="visuren.html#absolute-positioning" class="tocxref">9.6 Absolute positioning</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#fixed-positioning" class="tocxref">9.6.1 Fixed positioning</a>
</ul>
<li class="tocline2"><a href="visuren.html#dis-pos-flo" class="tocxref">9.7 Relationships between 'display', 'position', and 'float'</a>
<li class="tocline2"><a href="visuren.html#comparison" class="tocxref">9.8 Comparison of normal flow, floats, and absolute positioning</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#comp-normal-flow" class="tocxref">9.8.1 Normal flow</a>
<li class="tocline3"><a href="visuren.html#comp-relpos" class="tocxref">9.8.2 Relative positioning</a>
<li class="tocline3"><a href="visuren.html#comp-float" class="tocxref">9.8.3 Floating a box</a>
<li class="tocline3"><a href="visuren.html#comp-abspos" class="tocxref">9.8.4 Absolute positioning</a>
</ul>
<li class="tocline2"><a href="visuren.html#layers" class="tocxref">9.9 Layered presentation</a>
<ul class="toc">
<li class="tocline3"><a href="visuren.html#z-index" class="tocxref">9.9.1 Specifying the stack level: the <span class="propinst-z-index">'z-index'</span> property</a>
</ul>
<li class="tocline2"><a href="visuren.html#direction" class="tocxref">9.10 Text direction: the <span class="propinst-direction">'direction'</span> and <span class="propinst-unicode-bidi">'unicode-bidi'</span> properties</a>
</ul>
</div>
<!-- warning -->
<!-- /warning -->
<h2>9.1 <a name="visual-model-intro">Introduction to the visual formatting model</a></h2>
<p>This chapter and the next describe the <a name="x0"><span class="index-def"
title="visual formatting model">visual formatting model</span></a>: how user
agents process the <a href="conform.html#doctree">document tree</a>
for visual <a href="media.html">media</a>.
</p>
<p>In the visual formatting model, each element in the document tree
generates zero or more boxes according to the <a href="box.html">box
model</a>. The layout of these boxes is governed by:</p>
<ul>
<li><a href="box.html#box-dimensions">box dimensions</a> and <a
href="#box-gen">type</a>.
</li><li><a href="#positioning-scheme">positioning scheme</a>
(normal flow, float, and absolute positioning).
</li><li>relationships between elements
in the <a href="conform.html#doctree">document tree.</a>
</li><li>external information (e.g., viewport size, <a
href="conform.html#intrinsic">intrinsic</a> dimensions of images, etc.).
</li></ul>
<p>The properties defined in this chapter and the next apply to both
<a href="media.html#continuous-media-group">continuous media</a> and
<a href="media.html#paged-media-group">paged media</a>. <span class="paged">
However, the
meanings of the <a href="box.html#margin-properties">margin
properties</a> vary when applied to paged media (see the <a
href="page.html#page-margins">page model</a> for details).
</span>
</p>
<p>The visual formatting model does not specify all aspects of
formatting (e.g., it does not specify a letter-spacing algorithm). <a
href="conform.html#conformance">Conforming user agents</a> may behave
differently for those formatting issues not covered by this
specification.
</p>
<h3>9.1.1 <a name="viewport">The viewport</a></h3>
<p>User agents for <a
href="media.html#continuous-media-group">continuous media</a>
generally offer users a <a name="x1"><span class="index-def" title="viewport">
<dfn>viewport</dfn></span></a> (a window or other
viewing area on the screen) through which users consult a
document. User agents may change the document's layout when the
viewport is resized (see the <a
href="visudet.html#containing-block-details">initial containing block</a>).
</p>
<p>
When the viewport is smaller than the area of the canvas on which
the document is rendered, the user agent should offer a scrolling
mechanism.
There is at most
one viewport per <a href="intro.html#canvas">canvas</a>, but user
agents may render to more than one canvas (i.e., provide different
views of the same document).
</p>
<h3>9.1.2 <span class="index-def" title="containing block">
<a name="containing-block">Containing blocks</a></span>
</h3>
<p>In CSS 2, many box positions and sizes are calculated with respect
to the edges
of a rectangular box called a <a name="x3"><span class="index-def"
title="containing block"><dfn>containing block</dfn></span></a>. In
general, generated boxes act as containing blocks for descendant
boxes; we say that a box "establishes" the containing block for its
descendants. The phrase "a box's containing block" means "the
containing block in which the box lives," not the one it generates.
</p>
<p>Each box is given a position with respect to its containing block,
but it is not confined by this containing block; it may <a
href="visufx.html#overflow">overflow</a>.
</p>
<p>The <a href="visudet.html#containing-block-details">details</a> of
how a containing block's dimensions are calculated are described in
the <a href="visudet.html">next chapter</a>.
</p>
<h2>9.2 <a name="box-gen">Controlling box generation</a></h2>
<p>The following sections describe the types of boxes that may be
generated in CSS 2. A box's type affects, in part, its behavior in the
visual formatting model. The <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> property, described below,
specifies a box's type.
</p>
<h3>9.2.1 <a name="block-boxes">Block-level elements and block boxes</a></h3>
<p><span class="index-def" title="block-level
element"><a name="block-level"><dfn>Block-level elements</dfn></a></span> are those elements of the source document that are formatted visually as
blocks (e.g., paragraphs). The following values of the <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> property make an element
block-level: 'block', 'list-item', and 'table'.
</p>
<p><a name="x5"><span class="index-def" title="block-level box"><dfn>Block-level
boxes</dfn></span></a> are boxes that participate in
a <a href="#block-formatting">block formatting context.</a> Each
block-level element generates a <span class="index-def"
title="principal block-level
box"><a name="principal-box"><dfn>principal block-level
box</dfn></a></span> that contains descendant boxes and generated
content and is also the box involved in any positioning scheme.
Some block-level elements may generate additional boxes in addition
to the
principal box: 'list-item' elements. These additional boxes are
placed with respect to the principal box.
<p>Except for table boxes, which are described in a later chapter, and
replaced elements, a block-level box is also a block container box.
A <span class="index-def" title="block container box"><a
name="block-container-box"><dfn >block
container box</dfn></a></span> either
contains only block-level boxes or establishes an inline formatting
context and thus contains only inline-level boxes. Not all block
container boxes are block-level boxes: non-replaced inline blocks
and non-replaced table cells are block containers but not block-level
boxes. Block-level boxes that are also block containers are
called <a name="x8"><span class="index-def" title="block box"><dfn>block
boxes</dfn></span></a>.
<p>The three terms "block-level box," "block container box," and
"block box" are sometimes abbreviated as "block" where unambiguous.
<h4>9.2.1.1 <a name="anonymous-block-level">Anonymous block boxes</a></h4>
<p>In a document like this:
</p>
<pre><code class="html">
<DIV>
Some text
<P>More text
</DIV>
</code></pre>
<p>
(and assuming the DIV and the P both have 'display: block'), the
DIV appears to have both inline content and block content. To make it
easier to define the formatting, we assume that there is an <em><a name="x9"><span
class="index-def" title="anonymous">anonymous block box</span></a></em>
around "Some text".
</p>
<div class="figure">
<p><img src="images/anon-block.png" alt="diagram showing the three
boxes for the example above"><SPAN class="dlink"> <A name="img-anon-block" href="images/longdesc/anon-block-desc.html" title="Long description for anonymous block box">[D]</A></SPAN>
</p><p class="caption">Diagram showing the
three boxes, of which one is anonymous, for the example above.
</p></div>
<p>In other words: if a block container box (such as that generated
for the DIV above) has a block-level box inside it (such as the P
above), then we force it to have <em>only</em> block-level boxes
inside it.
<p>When an inline box contains an in-flow block-level box, the inline box
(and its inline ancestors within the same line box) is broken around
the block-level box (and any block-level siblings that are consecutive
or separated only by collapsible whitespace and/or out-of-flow
elements), splitting the inline box into two boxes (even if either
side is empty), one on each side of the block-level box(es). The line
boxes before the break and after the
break are enclosed in anonymous block boxes, and the block-level box
becomes a sibling of those anonymous boxes. When such an inline box is
affected by relative positioning, any resulting translation also
affects the block-level box contained in the inline box.
<div class="example"><P style="display:none">Example(s):</P>
<p>This model would apply in the following example if the following
rules:</p>
<pre><code class="css">
p { display: inline }
span { display: block }
</code></pre>
<p>were used with this HTML document:</p>
<pre class="html-example"><code class="html">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HEAD>
<TITLE>Anonymous text interrupted by a block</TITLE>
</HEAD>
<BODY>
<P>
<em>This is anonymous text before the SPAN.</em>
<SPAN>This is the content of SPAN.</SPAN>
<em>This is anonymous text after the SPAN.</em>
</P>
</BODY>
</code></pre>
<p>The P element contains a chunk (C1) of anonymous text followed
by a block-level element followed by another chunk (C2) of anonymous
text. The resulting boxes would be a block box representing the BODY,
containing an anonymous block box around C1, the SPAN block box, and
another anonymous block box around C2.
</p></div>
<p>The properties of anonymous boxes are inherited from the
enclosing non-anonymous box (e.g., in the example just below the subsection heading "Anonymous block boxes", the one for DIV).
Non-inherited properties have their initial value. For example,
the font of the anonymous box is inherited from the DIV, but the
margins will be 0.
</p>
<p>
Properties set on elements that cause anonymous block boxes to be
generated still apply to the boxes and content of that element. For
example, if a border had been set on the P element in the above
example, the border would be drawn around C1 (open at the end of the
line) and C2 (open at the start of the line).
</p>
<p>
Some user agents have implemented borders on inlines containing
blocks in other ways, e.g., by wrapping such nested blocks inside
"anonymous line boxes" and thus drawing inline borders around such
boxes. As CSS1 and CSS2 (1998) did not define this behavior, CSS1-only and
CSS2 (1998)-only user agents may implement this alternative model and still
claim conformance to this part of CSS 2. This does not apply to UAs
developed after this specification was released.
</p>
<p>Anonymous block boxes are ignored when resolving percentage values
that would refer to it: the closest non-anonymous ancestor box is used
instead. For example, if the child of the anonymous block box inside
the DIV above needs to know the height of its containing block to
resolve a percentage height, then it will use the height of the
containing block formed by the DIV, not of the anonymous block box.
<h3>9.2.2 <a name="inline-boxes">Inline-level elements and inline boxes</a></h3>
<p><span class="index-def" title="inline-level element">
<a name="inline-level"><dfn>Inline-level
elements</dfn></a></span> are those elements of the source document that
do not form new blocks of content; the content is distributed in lines
(e.g., emphasized pieces of text
within a paragraph, inline images,
etc.). The following values of the <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> property make an element
inline-level: 'inline', 'inline-table', and 'inline-block'.
Inline-level elements generate <a name="x11"><span class="index-def"
title="inline-level box"><dfn>inline-level
boxes</dfn></span></a>, which are boxes that participate in an inline
formatting context.
<p>An <span class="index-def" title="inline box"><a
name="inline-box"><dfn>inline
box</dfn></a></span> is one that is both inline-level and whose
contents participate in its containing inline formatting context. A
non-replaced element with a 'display' value of 'inline' generates an
inline box.
Inline-level boxes that are not inline boxes (such as replaced
inline-level elements, inline-block elements, and inline-table
elements) are called <a name="x13"><span class="index-def" title="atomic
inline-level box"><dfn>atomic inline-level boxes</dfn></span></a> because
they participate in their inline formatting context as a single opaque
box.
<h4>9.2.2.1 <a name="anonymous">Anonymous inline boxes</a></h4>
<p>Any text that is directly contained inside a block container element (not
inside an inline element) must be treated as an anonymous inline
element.
<p>In a document with HTML markup like this:</p>
<div class="html-example">
<pre><code class="html">
<p>Some <em>emphasized</em> text</p>
</code></pre>
</div>
<p>the <code><p></code> generates a block box, with several inline boxes inside
it. The box for "emphasized" is an inline box generated by an inline
element (<code><em></code>), but the other boxes ("Some" and "text") are inline boxes generated by a block-level element (<code><p></code>). The latter are called <a name="x14"><span
class="index-def" title="anonymous inline boxes">anonymous inline
boxes</span></a>, because they do not have an associated inline-level element.
</p>
<p>Such anonymous inline boxes inherit inheritable properties from
their block parent box. Non-inherited properties have their initial
value. In the example, the color of the anonymous inline boxes is
inherited from the P, but the background is transparent.
</p>
<p>
White space content that would subsequently be collapsed away according to the <a href="text.html#propdef-white-space" class="noxref"><span class="propinst-white-space">'white-space'</span></a> property does not generate any anonymous inline boxes.
</p>
<p>If it is clear from the context which type of anonymous box is
meant, both anonymous inline boxes and anonymous block boxes are
simply called anonymous boxes in this specification.
</p>
<p>There are more types of anonymous boxes that arise when formatting
<a href="tables.html#anonymous-boxes">tables</a>.
</p>
<h3>9.2.3 <a name="run-in">Run-in boxes</a></h3>
<p>[This section exists so that the section numbers are the same as in
previous drafts. <a name="x15"><span class="index-def" title="run-in">'Display:
run-in'</span></a> is now defined in CSS level 3 (see <a
href="/TR/css3-box">CSS basic box model</a>).]
<h3>9.2.4 <a name="display-prop">The</a> <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> property</h3>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'display'"><a name="propdef-display" class="propdef-title"><strong>'display'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td>inline | block | list-item | inline-block |
table | inline-table | table-row-group | table-header-group |
table-footer-group | table-row | table-column-group | table-column |
table-cell | table-caption | none | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>inline
<tr valign=baseline><td><em>Applies to:</em> <td>all elements
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>N/A
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#all-media-group" class="noxref">all</a>
<tr valign=baseline><td><em>Computed value:</em> <td>see text
</table>
</dl>
</div>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><span class="index-def" title="'block', definition of"><a
name="value-def-block"><strong>block</strong></a></span>
</dt>
<dd>This value causes an element to generate a block box.
</dd>
<dt><span class="index-def" title="'inline-block', definition of"><a
name="value-def-inline-block"><strong>inline-block</strong></a></span>
</dt>
<dd>This value causes an element to generate an inline-level block
container.
The inside of an inline-block is formatted as a block box, and the
element itself is formatted as an atomic inline-level box.
</dd>
<dt><span class="index-def" title="'inline', definition of"><a
name="value-def-inline"><strong>inline</strong></a></span>
</dt>
<dd>This value causes an element to generate one or more inline boxes.
</dd>
<dt><span class="index-def" title="'list-item', definition of"><a
name="value-def-list-item"><strong>list-item</strong></a></span>
</dt>
<dd>This value causes an element (e.g., LI in HTML) to generate a
principal block box and a marker box. For information about
lists and examples of list formatting, please consult the section on
<a href="generate.html#lists">lists</a>.
</dd>
<dt><strong>none</strong></dt>
<dd><a name="x21"><span class="index-def" title="'none'::as display value">This
value</span></a> causes an element to not appear in the <a
href="intro.html#formatting-structure">formatting structure</a> (i.e.,
in visual media the element generates no boxes and has no effect on
layout). Descendant elements do not generate any boxes either; the
element and its content are removed from the formatting structure
entirely. This behavior <strong>cannot</strong> be overridden by
setting the <a href="visuren.html#propdef-display" class="noxref"><span class="propinst-display">'display'</span></a> property
on the descendants.
<p>Please note that a display of 'none' does not create an invisible
box; it creates no box at all. CSS includes mechanisms that enable an
element to generate boxes in the formatting structure that affect
formatting but are not visible themselves. Please consult the section
on <a href="visufx.html#visibility">visibility</a> for details.
</p>
</dd>
<dt>
<a href="tables.html#value-def-table" class="noxref"><span class="value-inst-table">table</span></a>,
<a href="tables.html#value-def-inline-table" class="noxref"><span class="value-inst-inline-table">inline-table</span></a>,
<a href="tables.html#value-def-table-row-group" class="noxref"><span class="value-inst-table-row-group">table-row-group</span></a>,
<a href="tables.html#value-def-table-column" class="noxref"><span class="value-inst-table-column">table-column</span></a>,
<a href="tables.html#value-def-table-column-group" class="noxref"><span class="value-inst-table-column-group">table-column-group</span></a>,
<a href="tables.html#value-def-table-header-group" class="noxref"><span class="value-inst-table-header-group">table-header-group</span></a>,
<a href="tables.html#value-def-table-footer-group" class="noxref"><span class="value-inst-table-footer-group">table-footer-group</span></a>,
<a href="tables.html#value-def-table-row" class="noxref"><span class="value-inst-table-row">table-row</span></a>,
<a href="tables.html#value-def-table-cell" class="noxref"><span class="value-inst-table-cell">table-cell</span></a>, and
<a href="tables.html#value-def-table-caption" class="noxref"><span class="value-inst-table-caption">table-caption</span></a>
</dt>
<dd>These values cause an element to behave like a table element
(subject to restrictions described in the chapter on <a
href="tables.html">tables</a>).
</dd>
</dl>
<p>The computed value is the same as the specified value, except for
positioned and floating elements (see <a
href="#dis-pos-flo">Relationships between 'display', 'position', and
'float'</a>) and for the root element.
For the root element, the computed value is changed as described in
the section on the <a href="#dis-pos-flo">relationships between 'display', 'position', and 'float'</a>.
</p>
<p>Note that although the <a href="about.html#initial-value">initial
value</a> of <a href="visuren.html#propdef-display" class="noxref"><span class="propinst-display">'display'</span></a> is
'inline', rules in the user agent's <a
href="cascade.html#default-style-sheet">default style sheet</a> may <a
href="cascade.html">override</a> this value. See the <a
href="sample.html">sample style sheet</a> for HTML 4 in the
appendix.
</p>
<div class="example"><P style="display:none">Example(s):</P>
<p>Here are some examples of the <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> property:
</p>
<pre><code class="css">
p { display: block }
em { display: inline }
li { display: list-item }
img { display: none } /* Do not display images */
</code></pre>
</div>
<h2>9.3 <a name="positioning-scheme">Positioning schemes</a></h2>
<p>In CSS 2, a box may be laid out according to three <a name="x22"><span
class="index-def" title="positioning scheme"><dfn>positioning
schemes:</dfn></span></a></p>
<ol>
<li><a href="#normal-flow">Normal flow</a>. In CSS 2, normal
flow includes <a href="#block-formatting">block formatting</a>
of block-level boxes,
<a href="#inline-formatting">inline formatting</a>
of inline-level boxes, and <a
href="#relative-positioning">relative positioning</a> of
block-level and inline-level boxes.
</li>
<li><a href="#floats">Floats</a>. In the float model,
a box is first laid out according to the normal flow, then
taken out of the flow and shifted
to the left or right as far as possible. Content may
flow along the side of a float.
</li>
<li><a href="#absolute-positioning">Absolute positioning</a>.
In the absolute positioning model, a box is removed from
the normal flow entirely (it has no impact on later siblings)
and assigned a position with respect to a containing block.
</li>
</ol>
<p>An element is called <dfn><a name="x23"><span class="index-def">out of
flow</span></a></dfn> if it is floated, absolutely positioned, or is the
root element. An element is called <dfn><a name="x24"><span
class="index-def">in-flow</span></a></dfn> if it is not out-of-flow. The
<dfn><a name="x25"><span class="index-def">flow of an element</span></a></dfn>
<var>A</var> is the set consisting of <var>A</var> and all in-flow
elements whose nearest out-of-flow ancestor is <var>A</var>.
<div class="note">
<em><strong>Note.</strong>
CSS 2's positioning schemes help authors make their documents
more accessible by allowing them to avoid mark-up tricks
(e.g., invisible images) used for layout effects.
</em>
</div>
<h3>9.3.1 <a name="choose-position">Choosing a positioning scheme:</a> <a href="visuren.html#propdef-position" class="noxref"><span
class="propinst-position">'position'</span></a> property</h3>
<p>The <a href="visuren.html#propdef-position" class="noxref"><span class="propinst-position">'position'</span></a> and <a href="visuren.html#propdef-float" class="noxref"><span
class="propinst-float">'float'</span></a> properties determine which
of the CSS 2 positioning algorithms is used to calculate
the position of a box.
</p>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'position'"><a name="propdef-position" class="propdef-title"><strong>'position'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td>static | relative | absolute | fixed | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>static
<tr valign=baseline><td><em>Applies to:</em> <td>all elements
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>N/A
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr valign=baseline><td><em>Computed value:</em> <td>as specified
</table>
</dl>
</div>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><strong>static</strong></dt>
<dd>The box is a normal box, laid out according to the <a
href="#normal-flow">normal flow</a>. The
<a href="visuren.html#propdef-top" class="noxref"><span class="propinst-top">'top'</span></a>,
<a href="visuren.html#propdef-right" class="noxref"><span class="propinst-right">'right'</span></a>,
<a href="visuren.html#propdef-bottom" class="noxref"><span class="propinst-bottom">'bottom'</span></a>,
and <a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left">'left'</span></a>
properties do not apply.
</dd>
<dt><strong>relative</strong></dt>
<dd>The box's position is calculated according to the <a
href="#normal-flow">normal flow</a> (this is called the position in
normal flow). Then the box is offset <a
href="#relative-positioning">relative</a> to its normal position. When
a box B is relatively positioned, the position of the following box is
calculated as though B were not offset. The effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined.
</dd>
<dt><strong>absolute</strong></dt>
<dd> The box's position (and possibly size) is specified
with the <a href="visuren.html#propdef-top" class="noxref"><span class="propinst-top">'top'</span></a>,
<a href="visuren.html#propdef-right" class="noxref"><span class="propinst-right">'right'</span></a>,
<a href="visuren.html#propdef-bottom" class="noxref"><span class="propinst-bottom">'bottom'</span></a>, and
<a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left">'left'</span></a>
properties.
These properties specify offsets with respect to the box's
<a href="#containing-block">containing block</a>. Absolutely
positioned boxes are taken out of the normal flow. This means
they have no impact on the layout of later siblings. Also,
though <a href="#absolutely-positioned">absolutely positioned</a>
boxes have margins, they
do not <a href="box.html#collapsing-margins">collapse</a>
with any other margins.
</dd>
<dt><strong>fixed</strong></dt>
<dd> The box's position is calculated according to the 'absolute'
model, but in addition, the box is <a
href="#fixed-positioning">fixed</a> with respect to some reference.
As with the 'absolute' model, the box's margins do not collapse with any other margins.
In the case of handheld, projection, screen, tty, and tv media types,
the box is fixed with respect to the <a href="#viewport">viewport</a>
and does not move when
scrolled. In the case of the print media type, the box is rendered on every page, and is fixed with respect to the page box, even if the page is seen through a <a href="#viewport">viewport</a>
(in the case of a print-preview, for example). For other media
types, the presentation is undefined.
Authors may wish to specify 'fixed' in a
media-dependent way. For instance, an author may want a box to remain
at the top of the <a href="#viewport">viewport</a> on the screen, but
not at the top of each printed page. The two specifications may be
separated by using an <a href="media.html#at-media-rule">@media
rule</a>, as in:
<div class="example"><P style="display:none">Example(s):</P>
<pre><code class="css">
@media screen {
h1#first { position: fixed }
}
@media print {
h1#first { position: static }
}
</code></pre>
</div>
<p>UAs must not paginate the content of fixed boxes. <span
class="note">Note that UAs may print invisible content in other
ways. See <a href="page.html#outside-page-box">"Content outside the
page box"</a> in chapter 13.</span>
</dd>
</dl>
<p>
User agents may treat position as 'static' on the root element.
</p>
<h3>9.3.2 <a name="position-props">Box offsets</a>: <a href="visuren.html#propdef-top" class="noxref"><span
class="propinst-top">'top'</span></a>, <a href="visuren.html#propdef-right" class="noxref"><span
class="propinst-right">'right'</span></a>, <a href="visuren.html#propdef-bottom" class="noxref"><span
class="propinst-bottom">'bottom'</span></a>, <a href="visuren.html#propdef-left" class="noxref"><span
class="propinst-left">'left'</span></a></h3>
<p>An element is said to be <span class="index-def" title="positioned
element/box"><a name="positioned-element"><dfn>positioned</dfn></a></span>
if its <a href="visuren.html#propdef-position" class="noxref"><span class="propinst-position">'position'</span></a> property has
a value other than 'static'. Positioned elements generate
positioned boxes, laid out according to four properties:</p>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'top'"><a name="propdef-top" class="propdef-title"><strong>'top'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td><a href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><length></span></a> | <a href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><percentage></span></a> | auto | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>auto
<tr valign=baseline><td><em>Applies to:</em> <td>positioned elements
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>refer to height of containing block
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr valign=baseline><td><em>Computed value:</em> <td>if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise, 'auto'.
</table>
</dl>
</div>
<p>This property specifies how far an <a
href="#absolutely-positioned">absolutely positioned</a> box's top
margin edge is offset below the top edge of the box's <a
href="#containing-block">containing block</a>. For relatively
positioned boxes, the offset is with respect to the top edges of the
box itself (i.e., the box is given a position in the normal flow, then
offset from that position according to these properties).
</p>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'right'"><a name="propdef-right" class="propdef-title"><strong>'right'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td><a href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><length></span></a> | <a href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><percentage></span></a> | auto | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>auto
<tr valign=baseline><td><em>Applies to:</em> <td>positioned elements
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>refer to width of containing block
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr valign=baseline><td><em>Computed value:</em> <td>if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise,
'auto'.
</table>
</dl>
</div>
<p>Like 'top', but specifies how far a box's right margin edge is
offset to the left of the right edge of the box's <a
href="#containing-block">containing block</a>. For relatively
positioned boxes, the offset is with respect to the right edge of the
box itself.
</p>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'bottom'"><a name="propdef-bottom" class="propdef-title"><strong>'bottom'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td><a href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><length></span></a> | <a href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><percentage></span></a> | auto | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>auto
<tr valign=baseline><td><em>Applies to:</em> <td>positioned elements
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>refer to height of containing block
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr valign=baseline><td><em>Computed value:</em> <td>if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise, 'auto'.
</table>
</dl>
</div>
<p>Like 'top', but specifies how far a box's bottom margin edge is
offset above the bottom of the box's <a
href="#containing-block">containing block</a>. For relatively
positioned boxes, the offset is with respect to the bottom edge of the
box itself.
</p>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'left'"><a name="propdef-left" class="propdef-title"><strong>'left'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td><a href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><length></span></a> | <a href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><percentage></span></a> | auto | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>auto
<tr valign=baseline><td><em>Applies to:</em> <td>positioned elements
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>refer to width of containing block
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr valign=baseline><td><em>Computed value:</em> <td>if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise,
'auto'.
</table>
</dl>
</div>
<p>Like 'top', but specifies how far a box's left margin edge is
offset to the right of the left edge of the box's <a
href="#containing-block">containing block</a>. For relatively
positioned boxes, the offset is with respect to the left edge of the
box itself.
</p>
<p>The values for the four properties have the following meanings:</p>
<dl>
<dt><strong><a href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><length></span></a></strong></dt>
<dd>The offset is a fixed distance from the reference edge. Negative values are allowed.
</dd>
<dt><strong><a href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><percentage></span></a></strong></dt>
<dd>The offset is a percentage of the containing block's width (for <a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left">'left'</span></a> or <a href="visuren.html#propdef-right" class="noxref"><span
class="propinst-right">'right'</span></a>) or height (for <a href="visuren.html#propdef-top" class="noxref"><span
class="propinst-top">'top'</span></a> and <a href="visuren.html#propdef-bottom" class="noxref"><span
class="propinst-bottom">'bottom'</span></a>). Negative values are allowed.
</dd>
<dt><strong>auto</strong></dt>
<dd>For non-replaced elements, the effect of this value
depends on which of related properties have the value 'auto' as
well. See the sections on the
<a href="visudet.html#abs-non-replaced-width">width</a>
and <a href="visudet.html#abs-non-replaced-height">height</a>
of <a href="#absolutely-positioned">absolutely positioned</a>,
non-replaced elements for details. For replaced elements, the
effect of this value depends only on the intrinsic dimensions of the
replaced content. See the sections on the <a
href="visudet.html#abs-replaced-width">width</a> and <a
href="visudet.html#abs-replaced-height">height</a> of absolutely
positioned, replaced elements for details.
</dd>
</dl>
<h2>9.4 <a name="normal-flow">Normal flow</a></h2>
<p>Boxes in the normal flow belong to a <a name="x32"><span class="index-def"
title="formatting context">formatting context</span></a>, which may be
block or inline, but not both simultaneously. <a
href="#block-level">Block-level</a> boxes participate in a <a
href="#block-formatting">block formatting</a> context. <a
href="#inline-level">Inline-level boxes</a> participate in an <a
href="#inline-formatting">inline formatting</a> context.
</p>
<h3>9.4.1 <a name="block-formatting">Block formatting contexts</a></h3>
<p>Floats, absolutely positioned elements, block containers (such as
inline-blocks, table-cells, and table-captions) that are not block
boxes, and block boxes with 'overflow' other than 'visible'
(except when that value has been propagated to the viewport) establish
new block formatting contexts for their contents.</p>
<p>In a block formatting context, boxes are laid out one after the
other, vertically, beginning at the top of a containing block. The
vertical distance between two sibling boxes is determined by the <a href="box.html#propdef-margin" class="noxref"><span
class="propinst-margin">'margin'</span></a> properties. Vertical margins
between adjacent block-level boxes in a block formatting context <a
href="box.html#collapsing-margins">collapse</a>.
</p>
<p>
In a block formatting context, each box's left outer edge touches the
left edge of the containing block (for right-to-left formatting, right
edges touch). This is true even in the presence of floats (although a
box's <em>line boxes</em> may shrink due to the floats), unless the box
establishes a new block formatting context (in which case the box itself
<a href="#bfc-next-to-float"><em>may</em> become narrower</a> due to
the floats).
</p>
<p>For information about page breaks in paged media, please consult
the section on <a href="page.html#allowed-page-breaks">allowed
page breaks</a>.
</p>
<h3>9.4.2 <a name="inline-formatting">Inline formatting contexts</a></h3>
<p>In an inline formatting context, boxes are laid out horizontally,
one after the other, beginning at the top of a containing
block. Horizontal margins, borders, and padding are respected between
these boxes. The boxes may be aligned vertically in different ways: their
bottoms or tops 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 <span class="index-def" title="line box"><a
name="line-box"><dfn>line box</dfn></a></span>.
</p>
<p>The width of a line box is determined by a <a
href="#containing-block">containing block</a> and the presence of floats.
The height of a line
box is determined by the rules given in the section on <a
href="visudet.html#line-height">line height calculations</a>.
</p>
<p>A line box is always tall 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).
When the height of a box B is less than the height of the line box containing it,
the vertical alignment of B within the line box is determined by
the <a href="visudet.html#propdef-vertical-align" class="noxref"><span class="propinst-vertical-align">'vertical-align'</span></a> property.
When several inline-level boxes cannot fit horizontally within a single
line box, they are distributed among two or more vertically-stacked
line boxes. Thus, a paragraph is a vertical stack of line boxes. Line
boxes are stacked with no vertical separation (except as specified
elsewhere) and they never overlap.
</p>
<p>In general, the left edge of a line box touches the left edge
of its containing block and the right edge touches the right 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
width (that of the containing block), they may vary in width if
available horizontal space is reduced due to <a
href="#floats">floats</a>. Line boxes in the same inline formatting
context generally vary in height (e.g., one line might contain a tall
image while the others contain only text).
</p>
<p>When the total width of the inline-level boxes on a line is less than the
width of the line box containing them, their horizontal distribution
within the line box is determined by the <a href="text.html#propdef-text-align" class="noxref"><span
class="propinst-text-align">'text-align'</span></a> property. If that
property has the value 'justify', the user agent may stretch spaces
and words in inline boxes (but not inline-table and inline-block
boxes) as well.
</p>
<p>
When an inline box exceeds the width of a line box, it is split into several boxes and these boxes are distributed across several line boxes. If an inline box cannot be split (e.g., if the inline box contains a single character, or language specific word breaking rules disallow a break within the inline box, or if the inline box is affected by a white-space value of nowrap or pre), then the inline box overflows the line box.
</p>
<p>
When an inline box is split, margins,
borders, and padding have no visual effect where the split occurs (or
at any split, when there are several).
</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>
<p id="phantom-line-box">Line boxes are created as needed to hold
inline-level content within an inline formatting context. Line boxes
that contain no text, no <a
href="text.html#white-space-prop">preserved white space,</a> no inline
elements with non-zero margins, padding, or borders, and no other <a
href="#positioning-scheme">in-flow</a> content (such as images, inline
blocks or inline tables), and do not end with a preserved newline must
be treated as zero-height line boxes for the purposes of determining
the positions of any elements inside of them, and must be treated as
not existing for any other purpose.
</p>
<div class="html-example"><p>
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:
</p>
<pre><code class="html">
<P>Several <EM>emphasized words</EM> appear
<STRONG>in this</STRONG> sentence, dear.</P>
</code></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, 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>
or like this:
<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"><p>
Consider the following example:
</p>
<pre><code class="html">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
<HEAD>
<TITLE>Example of inline flow on several lines</TITLE>
<STYLE type="text/css">
EM {
padding: 2px;
margin: 1em;