-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathvisuren.html
More file actions
2692 lines (2359 loc) · 150 KB
/
visuren.html
File metadata and controls
2692 lines (2359 loc) · 150 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">
<html lang="en">
<head>
<title>Visual formatting model</title>
<link rel="stylesheet" href="style/default.css" type="text/css">
<link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD.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">
<meta name="editor" lang="tr" content="Tantek Çelik">
<style type="text/css">
<ins>.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}</ins>
</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><a name="q0">9 Visual formatting model</a></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"><ins>9.2.1.1</ins> 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"><ins>9.2.2.1</ins> Anonymous inline boxes</a>
</ul>
<li class="tocline3"><a href="visuren.html#run-in" class="tocxref">9.2.3 <del>Compact boxes 9.2.4</del>Run-in boxes</a>
<li class="tocline3"><a href="visuren.html#display-prop" class="tocxref"> <del>9.2.5</del><ins>9.2.4</ins> 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 <del>context</del><ins>contexts</ins></a>
<li class="tocline3"><a href="visuren.html#inline-formatting" class="tocxref">9.4.2 Inline formatting <del>context</del><ins>contexts</ins></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>
<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 <del>absolute).</del><ins>absolute positioning).</ins>
</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 <del>document's initial containing block,</del><ins>area of the canvas on which
the document is rendered,</ins> 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 <del>CSS2,</del><ins>CSS 2.1,</ins> 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"> <del>root of the document tree generates a box that serves as the initial containing block for subsequent layout. The width of the initial containing block may be specified with the 'width' property for the root element. If this property has the value 'auto', the user agent supplies the initial width (e.g., the user agent uses the current width of the viewport ). The height of the initial containing block may be specified with the 'height' property for the root element. If this property has the value 'auto', the containing block height will grow to accommodate the document's content. The initial containing block cannot be positioned or floated (i.e., user agents ignore the 'position' and 'float' properties for the root element). The</del>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 <del>CSS2.</del><ins>CSS 2.1.</ins> 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). <del>Several</del><ins>The following</ins> 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', <del>'compact'</del>and 'run-in' (part of the
time; see <a href="#run-in"> <del>compact and</del>run-in boxes</a>), and 'table'.
</p>
<p><a name="x5"><span class="index-def" title="block-level box"><dfn>Block-level
<del>elements generate</del><ins>boxes</ins></dfn></span></a> <ins>are boxes that participate in</ins>
a <a href="#block-formatting"> <del>principal</del>block <ins>formatting context.</ins></a> <ins>Each
block-level element generates a</ins> <span class="index-def"
title="principal block-level
box"><a name="principal-box"><dfn><ins>principal block-level</ins>
box</dfn></a></span> that <del>only</del>contains <del>block boxes . The principal block box establishes the containing block for</del>descendant boxes and generated
content and is also the box involved in any positioning scheme.
<del>Principal block boxes participate in a block formatting context .</del>Some block-level elements <ins>may</ins> generate additional boxes <del>outside of</del><ins>in addition
to</ins> the
principal box: 'list-item' <del>elements and those with markers .</del><ins>elements.</ins> These additional boxes are
placed with respect to the principal box.
<p> <del>Anonymous block boxes</del><ins>Except for table boxes, which are described</ins> in a <del>document like this: <DIV> Some text <P>More text </DIV> (and assuming the DIV and the P both have 'display: block'), the DIV appears to have both inline content</del><ins>later chapter,</ins> and
<ins>replaced elements, a block-level box is also a</ins> block <del>content. To make it easier to define the formatting,</del><ins>container box.
A</ins> <span class="index-def" title="block container box"><a
name="block-container-box"><dfn ><ins>block
container box</ins></dfn></a></span> <ins>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</ins> <a name="x8"><span class="index-def" title="block box"><dfn><ins>block
boxes</ins></dfn></span></a><ins>.</ins>
<p><ins>The three terms "block-level box," "block container box," and
"block box" are sometimes abbreviated as "block" where unambiguous.</ins>
<h4><ins>9.2.1.1</ins> <a name="anonymous-block-level"><ins>Anonymous block boxes</ins></a></h4>
<p><ins>In a document like this:</ins>
</p>
<pre><code class="html">
<ins><DIV>
Some text
<P>More text
</DIV></ins>
</code></pre>
<p>
<ins>(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,</ins> 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 <ins>container</ins> box (such as that generated
for the DIV above) has <del>another block</del><ins>a block-level</ins> box inside it (such as the P
above), then we force it to have <em>only</em> <del>block</del><ins>block-level</ins> boxes
inside <del>it, by wrapping any</del><ins>it.</ins>
<p><ins>When an inline box contains an in-flow block-level box, the inline box
(and its inline ancestors within the same line box) are broken around
the block-level box, dividing the</ins> inline <ins>box into two pieces (even if
either side is empty). The line</ins>
boxes <ins>before the break and after the
break are enclosed</ins> in <del>an</del>anonymous block <ins>boxes, and the block-level box
becomes a sibling of those anonymous boxes. When such an inline box is
affected by relative positioning, the relative positioning also
affects the block-level box contained in the inline</ins> 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">
<del>/* Note: HTML UAs may not respect these rules */ BODY</del><ins>p</ins> { display: inline }
<del>P</del><ins>span</ins> { 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 <del>4.0 Transitional//EN"></del><ins>4.01//EN"></ins>
<HEAD>
<TITLE>Anonymous text interrupted by a block</TITLE>
</HEAD>
<BODY>
<ins><P></ins>
<em>This is anonymous text before the <del>P. <P>This</del><ins>SPAN.</ins></em>
<ins><SPAN>This</ins> is the content of <del>P.</></del><ins>SPAN.</SPAN></ins>
<em>This is anonymous text after the <del>P.</del><ins>SPAN.</ins></em>
<ins></P></ins>
</BODY>
</code></pre>
<p>The <del>BODY</del><ins>P</ins> 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 an anonymous block box <del>for BODY,</del><ins>around the P,</ins>
containing an anonymous block box around C1, the <del>P</del><ins>SPAN</ins> 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 <del>(in</del><ins>(e.g., in</ins> the <del>example:</del><ins>example just below the subsection heading "Anonymous block boxes",</ins> 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>
<del>9.2.2 Inline-level elements and inline boxes Inline-level elements are those</del><ins>Properties set on</ins> elements <del>of the source document</del>that <del>do not form new blocks of content;</del><ins>cause anonymous block boxes to be
generated still apply to</ins> the <ins>boxes and</ins> content <del>is distributed in</del><ins>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).</ins>
</p>
<p>
<ins>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 did not define this behavior, CSS1-only and
CSS2-only user agents may implement this alternative model and still
claim conformance to this part of CSS 2.1. This does not apply to UAs
developed after this specification was released.</ins>
</p>
<p><ins>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.</ins>
<h3><ins>9.2.2</ins> <a name="inline-boxes"><ins>Inline-level elements and inline boxes</ins></a></h3>
<p><span class="index-def" title="inline-level element">
<a name="inline-level"><dfn><ins>Inline-level
elements</ins></dfn></a></span> <ins>are those elements of the source document that
do not form new blocks of content; the content is distributed in</ins> lines
(e.g., emphasized pieces of text
within a paragraph, inline images,
etc.). <del>Several</del><ins>The following</ins> values of the <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> property make an element
<del>inline:</del><ins>inline-level:</ins> 'inline', 'inline-table', <del>'compact'</del><ins>'inline-block'</ins>
and 'run-in' (part of the time; see <a href="#run-in"> <del>compact and</del>run-in boxes</a>).
Inline-level elements generate <a name="x11"><span class="index-def"
title="inline-level box"><dfn> <del>inline</del><ins>inline-level</ins>
boxes</dfn></span></a> <del>. Inline</del><ins>, which are</ins> boxes <del>may</del><ins>that</ins> participate in <del>several</del><ins>an inline</ins>
formatting <del>contexts: Within a block box,</del><ins>context.</ins>
<p>An <span class="index-def"><a name="inline-box"><dfn>inline
<del>boxes</del><ins>box</ins></dfn></a></span> <ins>is one that is both inline-level and whose
contents</ins> participate in <del>an</del><ins>its containing</ins> inline formatting <del>context .</del><ins>context.</ins> A
<del>compact inline box is given</del><ins>non-replaced element with</ins> a <del>position in the margin</del><ins>'display' value</ins> of <del>a block</del><ins>'inline' generates an
inline</ins> box. <del>Marker boxes are also given positions outside of</del><ins>An element with</ins> a <del>block box. Anonymous</del><ins>'display' value of 'run-in' can also
generate an</ins> inline <ins>box; see</ins> <a href="#run-in"><ins>run-in boxes.</ins></a>
<ins>Inline-level</ins> boxes <ins>that are not inline boxes (such as replaced
inline-level elements, inline-block elements, and inline-table
elements) are called</ins> <a name="x13"><span class="index-def" title="atomic
inline-level box"><dfn><ins>atomic inline-level boxes</ins></dfn></span></a> <ins>because
they participate in their inline formatting context as a single opaque
box.</ins>
<h4><ins>9.2.2.1</ins> <a name="anonymous"><ins>Anonymous inline boxes</ins></a></h4>
<p><ins>Any text that is directly contained inside a block container element (not
inside an inline element) must be treated as an anonymous inline
element.</ins>
<p>In a document <ins>with HTML markup</ins> like this:</p>
<div class="html-example">
<pre><code class="html">
<del><P>Some <EM>emphasized</em> text</P></del><ins><p>Some <em>emphasized</em> text</p></ins>
</code></pre>
</div>
<p>the <code> <del>P</del><ins><p></ins></code> generates a block box, with several inline boxes inside
it. The box for "emphasized" is an inline box generated by an inline
element <del>(EM),</del><ins>(</ins><code><ins><em></ins></code><ins>),</ins> but the other boxes ("Some" and "text") are inline boxes generated by a block-level element <del>(P).</del><ins>(</ins><code><ins><p></ins></code><ins>).</ins> The latter are called <a name="x14"><span
class="index-def" title="anonymous inline boxes">anonymous inline
boxes</span></a>, because they <del>don't</del><ins>do not</ins> 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 <del>initial</del><ins>inline</ins> boxes is
inherited from the P, but the background is transparent.
</p>
<p>
<ins>White space content that would subsequently be collapsed away according to the</ins> <a href="text.html#propdef-white-space" class="noxref"><span class="propinst-white-space"><ins>'white-space'</ins></span></a> <ins>property does not generate any anonymous inline boxes.</ins>
</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"> <del>Compact</del><ins>Run-in</ins> boxes</a></h3>
<p>A <a name="x15"><span class="index-def" title="run-in element"><dfn> <del>compact box</del><ins>run-in
element</ins></dfn></span></a> <ins>(or pseudo-element)</ins> <var><ins>A</ins></var> behaves as
follows:
<ol>
<li>If <var>A</var> <del>block box (that does not float and is not absolutely positioned ) follows the compact box, the compact box is formatted like</del><ins>has any</ins> <a
href="conform.html#child"><ins>children</ins></a> <ins>that</ins> <a
href="#inhibit-run-in"><ins>inhibit run-in behavior</ins></a> <ins>(see below), then</ins>
<var>A</var> <del>one-line inline box. The resulting box width</del>is <del>compared to one of the side margins of the block box.</del><ins>rendered as if it had 'display: block'.</ins>
<li><ins>Let</ins> <var><ins>B</ins></var> <ins>be</ins> the <del>choice</del><ins>first</ins> of <var> <del>left or right margin</del><ins>A</ins></var><ins>'s following</ins> <a
href="conform.html#sibling"><ins>siblings</ins></a> <ins>that</ins> is <del>determined by the 'direction'</del><ins>neither floating
nor</ins> <a href="visuren.html#absolutely-positioned"><ins>absolutely
positioned</ins></a> <ins>nor has 'display: none'. If</ins> <var><ins>B</ins></var> <ins>exists and has a</ins>
specified <ins>value</ins> for <del>the element producing the containing block for the compact box and following box. If the inline box width is less than</del><ins>'display' of 'block'</ins> or <del>equal to the margin, the inline box</del><ins>'list-item' and</ins> is <del>given</del><ins>not</ins>
<a href="conform.html#replaced-element"><ins>replaced,</ins></a> <ins>then</ins>
<var>A</var> <del>position in the margin</del><ins>is rendered</ins> as <del>described immediately below. Otherwise,</del><ins>an 'inline' element at</ins> the <del>compact box becomes a block</del><ins>start of</ins>
<var><ins>B</ins></var><ins>'s</ins> <a href="visuren.html#principal-box"><ins>principal</ins>
box.</a> <del>The compact box</del><ins>Note:</ins> <var><ins>A</ins></var> is <del>given</del><ins>rendered before</ins> <var><ins>B</ins></var><ins>'s
':before' pseudo-element, if any. See</ins> <a
href="generate.html#before-after-content"><ins>12.1.</ins></a>
<li><ins>Otherwise,</ins> <var>A</var> <del>position in the margin</del><ins>is rendered</ins> as <del>follows:</del><ins>if</ins> it <del>is outside (to</del><ins>had 'display:
block'.</ins>
</ol>
<p><ins>In</ins> the <del>left</del><ins>above, "siblings" and "children" include both normal
elements and :before/:after pseudo-elements.</ins>
<p id="inhibit-run-in"><ins>An element</ins> or <del>right)</del><ins>pseudo-element</ins> <var><ins>C</ins></var>
<dfn><ins>inhibits run-in behavior</ins></dfn> <ins>if one</ins> of the <del>first line box of the block, but it affects the calculation of that line box's height . The 'vertical-align' property of the compact box determines the vertical position of the compact box relative to</del><ins>following is
true. (Note</ins> that <del>line box. The horizontal position of</del>the <del>compact box</del><ins>definition</ins> is <del>always in</del><ins>recursive.)</ins>
<ol>
<li><var><ins>C</ins></var> <ins>is not floating and not</ins> <a
href="visuren.html#absolutely-positioned"><ins>absolutely positioned</ins></a>
<ins>and</ins> the <del>margin</del><ins>computed value</ins> of <del>the block box. An element that cannot be formatted on</del><ins>its 'display' is</ins> one <del>line cannot be placed in the margin</del>of <del>the following block. For example,</del><ins>'block',
'list-item', 'table' or 'run-in'.</ins>
<li><var><ins>C</ins></var> <ins>has</ins> a <del>'compact' element in HTML</del><ins>computed value for 'display' of 'inline' and
it has one or more children</ins> that <del>contains a BR element will always be formatted as</del><ins>inhibit run-in behavior. (Where
"children" includes both normal elements and :before/:after
pseudo-elements.)</ins>
</ol>
<p>A <del>block</del><ins>'run-in'</ins> box <del>(assuming the default style for BR, which inserts a newline).</del><ins>is useful</ins> for <del>placing multi-line texts</del><ins>run-in headers, as</ins>
in <del>the margin, the 'float' property is often more appropriate. The following example illustrates a compact box.</del><ins>this example:</ins>
</p>
<div class="html-example">
<pre><code class="html">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML <del>4.0//EN"></del><ins>4.01//EN"></ins>
<HTML>
<HEAD>
<TITLE>A <del>compact</del><ins>run-in</ins> box example</TITLE>
<STYLE type="text/css">
<del>DT</del><ins>H3</ins> { display: <del>compact } DD { margin-left: 4em</del><ins>run-in</ins> }
</STYLE>
</HEAD>
<BODY>
<del><DL> <DT>Short <DD><P>Description goes here. <DT>too long for the margin <DD><P>Description goes here. </DL></del><ins><H3>A run-in heading.</H3>
<P>And a paragraph of text that
follows it.</ins>
</BODY>
</HTML>
</code></pre>
</div>
<p>This example might be formatted as:</p>
<pre>
<b> <del>short Description goes here too long for the margin Description goes here The 'text-align' property can be used to align the compact element inside the margin: against the left edge of the margin ('left'), against the right edge ('right'), or centered in the margin ('center'). The value 'justify' doesn't apply,</del><ins>A run-in heading.</ins></b> And <del>is handled as either 'left' or 'right', depending on the 'direction'</del><ins>a
paragraph of text that
follows it.</ins>
</pre>
<p><ins>Despite appearing visually part</ins> of the <del>block-level</del><ins>following block box,
a run-in</ins> element <ins>still inherits properties from its parent</ins>
in <del>whose margin the compact element is formatted. ('left' if</del>the <del>direction is 'ltr', 'right' if</del><ins>source tree.</ins>
It is <del>'rtl'.)</del><ins>undefined in CSS 2.1 if a run-in inherits from a
':first-line' pseudo-element.</ins>
</p>
<p>Please consult the section on
<a href="generate.html#before-after-content">generated content</a>
for information about how <del>compact</del><ins>run-in</ins> boxes interact with generated
content.
</p>
<h3>9.2.4 <a name="display-prop"><ins>The</ins></a> <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display"><ins>'display'</ins></span></a> <ins>property</ins></h3>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'display'"><a name="propdef-display" class="propdef-title"><strong><ins>'display'</ins></strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em><ins>Value:</ins></em><ins> </ins><td><ins>inline | block | list-item |</ins> run-in <del>boxes A run-in box behaves as follows: If a block box (that does not float and is not absolutely positioned ) follows the run-in box, the run-in box becomes the first inline box of the block box. Otherwise, the run-in box becomes a block box. A 'run-in' box is useful for run-in headers, as in this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <HTML> <HEAD> <TITLE>A run-in box example</TITLE> <STYLE type="text/css"> H3 { display: run-in } </STYLE> </HEAD> <BODY> <H3>A run-in heading.</H3> <P>And a paragraph of text that follows it. </BODY> </HTML> This example might be formatted as: A run-in heading. And a paragraph of text that follows it. The properties of the run-in element are inherited from its parent in the source tree, not from the block box it visually becomes part of. Please consult the section on generated content for information about how run-in boxes interact with generated content. 9.2.5 The 'display' property 'display' Value: inline | block | list-item | run-in | compact</del>| <del>marker</del><ins>inline-block</ins> |
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><ins>Computed value:</ins></em><ins> </ins><td><ins>see text</ins>
</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 <del>principal</del>block box.
</dd>
<dt><span class="index-def" title="'inline-block', definition of"><a
name="value-def-inline-block"><strong><ins>inline-block</ins></strong></a></span>
</dt>
<dd><ins>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.</ins>
</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 <del>list-item inline</del><ins>marker</ins> 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> <del>marker This value declares generated content before or after a box to be a marker. This value should only be used with :before and :after pseudo-elements attached to block-level elements. In other cases, this value is interpreted as 'inline'. Please consult the section on markers for more information.</del>none</strong></dt>
<dd><a name="x21"><span class="index-def" title="'none'::as display value">This
value</span></a> causes an element to <del>generate no boxes</del><ins>not appear</ins> in the <a
href="intro.html#formatting-structure">formatting structure</a> (i.e.,
<ins>in visual media</ins> the element <ins>generates no boxes and</ins> has no effect on
layout). Descendant elements do not generate any boxes either; <del>this behavior cannot be overridden by</del><ins>the
element and its content are removed from the formatting structure
entirely. This behavior</ins> <strong><ins>cannot</ins></strong> <ins>be overridden by</ins>
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><span class="index-def" title="'run-in', definition of"><a
name="value-def-run-in"><strong>run-in</strong></a></span>
</dt>
<dd> <del>and compact These values create</del><ins>This value creates</ins> either block or
inline boxes, depending on context.
Properties apply to run-in <del>and compact</del>boxes based on their
final status (inline-level or block-level).
</dd>
<dt>
<a href="tables.html#value-def-table" class="noxref"><span class="value-inst-table"> <del>For example, the 'white-space' property only applies if the box becomes a block box.</del>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><ins>The computed value is the same as the specified value, except for
positioned and floating elements (see</ins> <a
href="#dis-pos-flo"><ins>Relationships between 'display', 'position', and
'float'</ins></a><ins>) and for the root element.
For the root element, the computed value is changed as described in
the section on the</ins> <a href="#dis-pos-flo"><ins>relationships between 'display', 'position', and 'float'</ins></a><ins>.</ins>
</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 <del>4.0</del><ins>4</ins> 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 } /* <del>Don't</del><ins>Do not</ins> display images */
</code></pre>
</div>
<h2> <del>Conforming HTML user agents may ignore the 'display' property.</del>9.3 <a name="positioning-scheme">Positioning schemes</a></h2>
<p>In <del>CSS2,</del><ins>CSS 2.1,</ins> a box may be laid out according to three <a name="x23"><span
class="index-def" title="positioning scheme"><dfn>positioning
schemes:</dfn></span></a></p>
<ol>
<li><a href="#normal-flow">Normal flow</a>. In <del>CSS2,</del><ins>CSS 2.1,</ins> normal
flow includes <a href="#block-formatting">block formatting</a>
of <del>block</del><ins>block-level</ins> boxes,
<a href="#inline-formatting">inline formatting</a>
of <del>inline</del><ins>inline-level</ins> boxes, <a
href="#relative-positioning">relative positioning</a> of
<del>block or inline</del><ins>block-level and inline-level</ins> boxes, and <del>positioning</del><ins>formatting</ins> of
<a href="#run-in"> <del>compact and</del>run-in</a> 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>
<div class="note">
<em><strong>Note.</strong>
<del>CSS2's</del><ins>CSS 2.1's</ins> 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 <del>CSS2</del><ins>CSS 2.1</ins> 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 <del>elements, but not to generated content</del><ins>elements</ins>
<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><ins>Computed value:</ins></em><ins> </ins><td><ins>as specified</ins>
</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"> <del>'left' and</del>'top'</span></a><ins>,</ins>
<a href="visuren.html#propdef-right" class="noxref"><span class="propinst-right"><ins>'right'</ins></span></a><ins>,</ins>
<a href="visuren.html#propdef-bottom" class="noxref"><span class="propinst-bottom"><ins>'bottom'</ins></span></a><ins>,
and</ins> <a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left"><ins>'left'</ins></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. <ins>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.</ins>
</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"> <del>'left'</del><ins>'top'</ins></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"> <del>'top'</del><ins>'bottom'</ins></span></a>, and
<a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left"> <del>'bottom'</del><ins>'left'</ins></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.
<ins>As with the 'absolute' model, the box's margins do not collapse with any other margins.</ins>
In the case of <del>continuous</del><ins>handheld, projection, screen, tty, and tv</ins> media <del>,</del><ins>types,</ins>
the box is fixed with respect to the <a href="#viewport">viewport</a>
<del>(and doesn't</del><ins>and does not</ins> move when
<del>scrolled).</del><ins>scrolled.</ins> In the case of <del>paged</del><ins>the print</ins> media <del>,</del><ins>type,</ins> the box is <ins>rendered on every page, and is</ins> fixed with respect to the <del>page,</del><ins>page box,</ins> even if <del>that</del><ins>the</ins> page is seen through a <a href="#viewport">viewport</a>
(in the case of a print-preview, for example). <ins>For other media
types, the presentation is undefined.</ins>
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><ins>UAs must not paginate the content of fixed boxes.</ins> <span
class="note"><ins>Note that UAs may print invisible content in other
ways. See</ins> <a href="page.html#outside-page-box"><ins>"Content outside the
page box"</ins></a> <ins>in chapter 13.</ins></span>
</dd>
</dl>
<p>
<ins>User agents may treat position as 'static' on the root element.</ins>
</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><ins>Computed value:</ins></em><ins> </ins><td><ins>for 'position:static', 'auto'. Otherwise: if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise, 'auto'.</ins>
</table>
</dl>
</div>
<p>This property specifies how far <del>a</del><ins>an</ins> <a
href="#absolutely-positioned"><ins>absolutely positioned</ins></a> box's top
<del>content</del><ins>margin</ins> edge is offset below the top edge of the box's <a
href="#containing-block">containing block</a>. <del>'right' Value: <length> | <percentage> | auto | inherit Initial:</del><ins>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).</ins>
</p>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'right'"><a name="propdef-right" class="propdef-title"><strong><ins>'right'</ins></strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em><ins>Value:</ins></em><ins> </ins><td><a href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><ins><length></ins></span></a> <ins>|</ins> <a href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><ins><percentage></ins></span></a> <ins>| auto |</ins> <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit"><ins>inherit</ins></span></a>
<tr valign=baseline><td><em><ins>Initial:</ins></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> <del>This property</del><ins>Computed value:</ins></em><ins> </ins><td><ins>for 'position:static', 'auto'. Otherwise: if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise,
'auto'.</ins>
</table>
</dl>
</div>
<p><ins>Like 'top', but</ins> specifies how far a box's right <del>content</del><ins>margin</ins> edge is
offset to the left of the right edge of the box's <a
href="#containing-block">containing block</a>. <ins>For relatively
positioned boxes, the offset is with respect to the right edge of the
box itself.</ins>
</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> <del>This property</del><ins>Computed value:</ins></em><ins> </ins><td><ins>for 'position:static', 'auto'. Otherwise: if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise, 'auto'.</ins>
</table>
</dl>
</div>
<p><ins>Like 'top', but</ins> specifies how far a box's bottom <del>content</del><ins>margin</ins> edge is
offset above the bottom of the box's <a
href="#containing-block">containing block</a>. <ins>For relatively
positioned boxes, the offset is with respect to the bottom edge of the
box itself.</ins>
</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> <del>This property</del><ins>Computed value:</ins></em><ins> </ins><td><ins>for 'position:static', 'auto'. Otherwise: if
specified as a length, the corresponding absolute length; if
specified as a percentage, the specified value; otherwise,
'auto'.</ins>
</table>
</dl>
</div>
<p><ins>Like 'top', but</ins> specifies how far a box's left <del>content</del><ins>margin</ins> edge is
offset to the right of the left edge of the box's <a
href="#containing-block">containing block</a>. <ins>For relatively
positioned boxes, the offset is with respect to the left edge of the
box itself.</ins>
</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. <ins>Negative values are allowed.</ins>
</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>). <del>For 'top' and 'bottom', if the height of the containing block is not specified explicitly (i.e., it depends on content height), the percentage value is interpreted like 'auto'.</del><ins>Negative values are allowed.</ins>
</dd>
<dt><strong>auto</strong></dt>
<dd><ins>For non-replaced elements,</ins> 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 <del>absolutely positioned boxes, the offsets are with respect to the box's containing block . For relatively positioned boxes,</del><ins>replaced elements,</ins> the
<del>offsets are with respect to</del><ins>effect of this value depends only on</ins> the <del>outer edges</del><ins>intrinsic dimensions</ins> of the
<del>box itself (i.e.,</del><ins>replaced content. See</ins> the <del>box is given a position in</del><ins>sections on</ins> the <a
href="visudet.html#abs-replaced-width"> <del>normal flow, then offset from that position according to these properties).</del><ins>width</ins></a> <ins>and</ins> <a
href="visudet.html#abs-replaced-height"><ins>height</ins></a> <ins>of absolutely
positioned, replaced elements for details.</ins>
</dd>
</dl>
<h2>9.4 <a name="normal-flow">Normal flow</a></h2>
<p>Boxes in the normal flow belong to a <a name="x30"><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"> <del>Block</del><ins>Block-level</ins></a> boxes participate in a <a
href="#block-formatting">block formatting</a> context. <a
href="#inline-level"> <del>Inline</del><ins>Inline-level</ins> boxes</a> participate in an <a
href="#inline-formatting">inline formatting</a> context.
</p>
<h3>9.4.1 <a name="block-formatting">Block formatting <del>context</del><ins>contexts</ins></a></h3>
<p><ins>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.</ins></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 <del>block</del><ins>block-level</ins> 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> <del>content area</del><ins>line boxes</ins></em> may shrink due to the <ins>floats), unless the box
establishes a new block formatting context (in which case the box itself</ins>
<a href="#bfc-next-to-float"><em><ins>may</ins></em> <ins>become narrower</ins></a> <ins>due to
the</ins> 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 <del>context</del><ins>contexts</ins></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> <del>.</del><ins>and the presence of floats.</ins>
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 <del>inline</del><ins>inline-level</ins> 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 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 <del>inline</del><ins>inline-level</ins> 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 <del>the</del><ins>spaces
and words in</ins> inline boxes <ins>(but not inline-table and inline-block
boxes)</ins> as well.
</p>
<p>
<del>Since</del><ins>When</ins> an inline box <del>may not exceed</del><ins>exceeds</ins> the width of a line box, <del>long inline boxes are</del><ins>it is</ins> split into several boxes and these boxes <ins>are</ins> distributed across several line boxes. <ins>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.</ins>
</p>
<p>
When an inline box is split, margins,
borders, and padding have no visual effect where the split <del>occurs. Formatting of margins, borders, and padding may not be fully defined if the split</del>occurs <del>within a bidirectional embedding.</del><ins>(or
at any split, when there are several).</ins>