-
Notifications
You must be signed in to change notification settings - Fork 792
Expand file tree
/
Copy pathvisudet.html
More file actions
1689 lines (1464 loc) · 113 KB
/
visudet.html
File metadata and controls
1689 lines (1464 loc) · 113 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 details</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="visuren.html">
<link rel="next" href="visufx.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">
<ins>.current,.proposed,span.delcurrent,div.delcurrent { background:#feb }
ins.proposed,span.insproposed,li.insproposed,div.insproposed { background:#bfb }
del.proposed,span.delproposed { background:#fbb }
span.insproposed,li.insproposed,div.insproposed { text-decoration:underline }
span.delproposed,span.delcurrent,div.delcurrent { text-decoration:line-through }
body>del,body>ins {display:block}</ins>
</style>
</head>
<body>
<div class="navbar">
<p><a href="visuren.html">previous</a>
<a href="visufx.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">10 Visual formatting model details</a></h1>
<div class="subtoc">
<p><strong>Contents</strong>
<ul class="toc">
<li class="tocline2"><a href="visudet.html#containing-block-details" class="tocxref">10.1 Definition of "containing block"</a>
<li class="tocline2"><a href="visudet.html#the-width-property" class="tocxref">10.2 Content width: the <span class="propinst-width">'width'</span> property</a>
<li class="tocline2"><a href="visudet.html#Computing_widths_and_margins" class="tocxref">10.3 <del>Computing</del><ins>Calculating</ins> widths and margins</a>
<ul class="toc">
<li class="tocline3"><a href="visudet.html#inline-width" class="tocxref">10.3.1 Inline, non-replaced elements</a>
<li class="tocline3"><a href="visudet.html#inline-replaced-width" class="tocxref">10.3.2 Inline, replaced elements</a>
<li class="tocline3"><a href="visudet.html#blockwidth" class="tocxref">10.3.3 Block-level, non-replaced elements in normal flow</a>
<li class="tocline3"><a href="visudet.html#block-replaced-width" class="tocxref">10.3.4 Block-level, replaced elements in normal flow</a>
<li class="tocline3"><a href="visudet.html#float-width" class="tocxref">10.3.5 Floating, non-replaced elements</a>
<li class="tocline3"><a href="visudet.html#float-replaced-width" class="tocxref">10.3.6 Floating, replaced elements</a>
<li class="tocline3"><a href="visudet.html#abs-non-replaced-width" class="tocxref">10.3.7 Absolutely positioned, non-replaced elements</a>
<li class="tocline3"><a href="visudet.html#abs-replaced-width" class="tocxref">10.3.8 Absolutely positioned, replaced elements</a>
<li class="tocline3"><a href="visudet.html#inlineblock-width" class="tocxref"><ins>10.3.9 'Inline-block', non-replaced elements in normal flow</ins></a>
<li class="tocline3"><a href="visudet.html#inlineblock-replaced-width" class="tocxref"><ins>10.3.10 'Inline-block', replaced elements in normal flow</ins></a>
</ul>
<li class="tocline2"><a href="visudet.html#min-max-widths" class="tocxref">10.4 Minimum and maximum widths: <span class="propinst-min-width">'min-width'</span> and <span class="propinst-max-width">'max-width'</span></a>
<li class="tocline2"><a href="visudet.html#the-height-property" class="tocxref">10.5 Content height: the <span class="propinst-height">'height'</span> property</a>
<li class="tocline2"><a href="visudet.html#Computing_heights_and_margins" class="tocxref">10.6 <del>Computing</del><ins>Calculating</ins> heights and margins</a>
<ul class="toc">
<li class="tocline3"><a href="visudet.html#inline-non-replaced" class="tocxref">10.6.1 Inline, non-replaced elements</a>
<li class="tocline3"><a href="visudet.html#inline-replaced-height" class="tocxref">10.6.2 <del>Inline,</del><ins>Inline</ins> replaced <del>elements block-level,</del><ins>elements, block-level</ins> replaced elements in normal flow, <ins>'inline-block' replaced elements in normal flow</ins> and <del>floating,</del><ins>floating</ins> replaced elements</a>
<li class="tocline3"><a href="visudet.html#normal-block" class="tocxref">10.6.3 <del>Block-level,</del><ins>Block-level</ins> non-replaced elements in normal <del>flow, and floating, non-replaced elements</del><ins>flow when 'overflow' computes to 'visible'</ins></a>
<li class="tocline3"><a href="visudet.html#abs-non-replaced-height" class="tocxref">10.6.4 Absolutely positioned, non-replaced elements</a>
<li class="tocline3"><a href="visudet.html#abs-replaced-height" class="tocxref">10.6.5 Absolutely positioned, replaced elements</a>
<li class="tocline3"><a href="visudet.html#block-root-margin" class="tocxref"><ins>10.6.6 Complicated cases</ins></a>
<li class="tocline3"><a href="visudet.html#root-height" class="tocxref"><ins>10.6.7 'Auto' heights for block formatting context roots</ins></a>
</ul>
<li class="tocline2"><a href="visudet.html#min-max-heights" class="tocxref">10.7 Minimum and maximum heights: <span class="propinst-min-height">'min-height'</span> and <span class="propinst-max-height">'max-height'</span></a>
<li class="tocline2"><a href="visudet.html#line-height" class="tocxref">10.8 Line height calculations: the <span class="propinst-line-height">'line-height'</span> and <span class="propinst-vertical-align">'vertical-align'</span> properties</a>
<ul class="toc">
<li class="tocline3"><a href="visudet.html#leading" class="tocxref">10.8.1 Leading and half-leading</a>
</ul>
</ul>
</div>
<h2>10.1 <a name="containing-block-details">Definition of "containing
block"</a></h2>
<p>The position and size of an element's box(es) are sometimes
<del>computed</del><ins>calculated</ins> relative to a certain rectangle, called the <dfn><a name="x0"><span
class="index-def" title="containing block">containing
block</span></a></dfn> of the element. The containing block of an element
is defined as follows:</p>
<ol>
<li>The containing block <del>(called the initial containing block)</del>in which the <a href="conform.html#root">root
element</a> lives is <del>chosen by</del><ins>a rectangle called</ins> the <dfn><a name="x1"><span
class="index-def" title="initial containing block|containing
block::initial"> <del>user agent.</del><ins>initial containing block</ins></span></a></dfn><ins>. For continuous
media, it has the dimensions of the</ins> <a
href="visuren.html#viewport"><ins>viewport</ins></a> <ins>and is anchored at the
canvas origin; it is the</ins> <a href="page.html#page-area"><ins>page area</ins></a>
<ins>for paged media. The 'direction' property of the initial
containing block is the same as for the root element.</ins>
</li>
<li>For other elements, <del>unless</del><ins>if</ins> the <del>element</del><ins>element's position</ins> is <del>absolutely positioned ,</del><ins>'relative' or 'static',</ins>
the containing block is formed by the content edge of the nearest
<del>block-level</del>ancestor <del>box.</del><ins>box that is a</ins> <a href="visuren.html#block-boxes"><ins>block
container</ins></a> <ins>or which establishes a formatting context.</ins>
</li>
<li>If the element has 'position: fixed', the containing block is
established by the <a href="visuren.html#viewport">viewport</a>
<del>.</del><ins>in the case of continuous media or the page area in the case of paged media.</ins>
</li>
<li>If the element has 'position: absolute', the containing block is
established by the nearest ancestor with a <a href="visuren.html#propdef-position" class="noxref"><span
class="propinst-position">'position'</span></a> <del>other than 'static',</del><ins>of 'absolute', 'relative'
or 'fixed',</ins> in the following way:
<ol>
<li>In the case that the ancestor is <del>block-level,</del><ins>an inline element,</ins> the containing
block is <del>formed by</del><ins>the bounding box around</ins> the padding <del>edge</del><ins>boxes</ins> of the <del>ancestor. In</del><ins>first and</ins>
the <del>case</del><ins>last inline boxes
generated for</ins> that <ins>element. In CSS 2.1, if</ins> the <del>ancestor</del><ins>inline
element</ins> is <del>inline-level,</del><ins>split
across multiple lines,</ins> the containing block <del>depends on the 'direction' property of the ancestor: If the 'direction'</del>is <del>'ltr', the top and left of</del><ins>undefined.</ins>
</li>
<li><ins>Otherwise,</ins> the containing block
<del>are the top and left content edges of the first box generated by the ancestor, and the bottom and right are the bottom and right content edges of the last box of the ancestor. If the 'direction'</del>is <del>'rtl', the top and right are the top and right edges of the first box generated</del><ins>formed</ins> by the <a href="box.html#padding-edge"> <del>ancestor, and the bottom and left are the bottom and left content edges of the last box</del><ins>padding edge</ins></a> of
the ancestor.
</li>
</ol>
<p>If there is no such ancestor, the <del>content edge of the root element's box establishes</del><ins>containing block is</ins> the <ins>initial</ins>
containing block.
</p>
</li>
</ol>
<p><ins>In paged media, an absolutely positioned element is positioned
relative to its containing block ignoring any page breaks (as if the
document were continuous). The element may subsequently be broken over
several pages.</ins>
</p>
<p><ins>For absolutely positioned content that resolves to a position on a
page other than the page being laid out (the current page), or
resolves to a position on the current page which has already been
rendered for printing, printers may place the content</ins>
<ul>
<li><ins>on another location on the current page,</ins>
<li><ins>on a subsequent page, or</ins>
<li><ins>may omit it.</ins>
</ul>
<p class="note"><ins>Note that a
block-level element that is split over several pages may have a different
width on each page and that there may be device-specific limits.</ins>
</p>
<div class="example"><P style="display:none">Example(s):</P>
<p>With no positioning, the containing blocks (C.B.) in the
following document:</p>
<pre class="html-example">
<ins><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"></ins>
<HTML>
<HEAD>
<TITLE>Illustration of containing blocks</TITLE>
</HEAD>
<BODY id="body">
<DIV id="div1">
<P id="p1">This is text in the first paragraph...</P>
<P id="p2">This is text <EM id="em1"> in the
<STRONG id="strong1">second</STRONG> paragraph.</EM></P>
</DIV>
</BODY>
</HTML>
</pre>
<p>are established as follows:</p>
<table border="1">
<tr><th>For box generated by </th>
<td><strong>C.B. is established by</strong></td></tr>
<tr><td> <del>body</del><ins>html</ins></td><td>initial C.B. (UA-dependent)</td></tr>
<tr><td><ins>body</ins></td><td><ins>html</ins></td></tr>
<tr><td>div1</td><td>body</td></tr>
<tr><td>p1</td><td>div1</td></tr>
<tr><td>p2</td><td>div1</td></tr>
<tr><td>em1</td><td>p2</td></tr>
<tr><td>strong1</td><td>p2</td></tr>
</table>
<p>If we position "div1":</p>
<pre class="example">
#div1 { position: absolute; left: 50px; top: 50px }
</pre>
<p>its containing block is no longer "body"; it becomes
the initial containing block (since there are no
other positioned ancestor boxes).
</p>
<p>If we position "em1" as well:</p>
<pre class="example">
#div1 { position: absolute; left: 50px; top: 50px }
#em1 { position: absolute; left: 100px; top: 100px }
</pre>
<p>the table of containing blocks becomes:</p>
<table border="1">
<tr><th>For box generated by</th>
<td><strong>C.B. is established by</strong></td></tr>
<tr><td> <del>body</del><ins>html</ins></td><td>initial C.B. <ins>(UA-dependent)</ins></td></tr>
<tr><td><ins>body</ins></td><td><ins>html</ins></td></tr>
<tr><td>div1</td><td>initial C.B.</td></tr>
<tr><td>p1</td><td>div1</td></tr>
<tr><td>p2</td><td>div1</td></tr>
<tr><td>em1</td><td>div1</td></tr>
<tr><td>strong1</td><td>em1</td></tr>
</table>
<p>By positioning "em1", its containing block becomes
the nearest positioned ancestor box (i.e., that generated
by "div1").
</p>
</div>
<h2>10.2 <a name="the-width-property">Content width</a>: the <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width">'width'</span></a> property</h2>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'width'"><a name="propdef-width" class="propdef-title"><strong>'width'</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>all elements but non-replaced inline elements, table rows, and row groups
<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><ins>Computed value:</ins></em><ins> </ins><td><ins>the percentage or 'auto' as specified or the absolute length</ins>
</table>
</dl>
</div>
<p> This property specifies the <a
href="box.html#content-width">content width</a> of <del>boxes generated by block-level and replaced elements.</del><ins>boxes.</ins>
</p>
<p>This property does not apply to non-replaced <a
href="visuren.html#inline-boxes"> <del>inline-level</del><ins>inline</ins></a> elements. The
<ins>content</ins> width
of a non-replaced inline element's boxes is that of the rendered
content within them (<em>before</em> any relative offset of
children). Recall that inline boxes flow into <a
href="visuren.html#line-box">line boxes</a>. The width of line boxes
is given by the their <a
href="visuren.html#containing-block">containing block</a>, but may be
shorted by the presence of <a href="visuren.html#floats">floats</a>.
</p>
<p> <del>The width of a replaced element's box is intrinsic and may be scaled by the user agent if the value of this property is different than 'auto'.</del>Values have the following meanings:</p>
<dl>
<dt><span class="index-inst" title="<length>"><a name="x4" href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><strong><length></strong></span></a></span>
</dt>
<dd>Specifies <ins>the width of the content area using</ins> a <del>fixed width.</del><ins>length unit.</ins>
</dd>
<dt><span class="index-inst" title="<percentage>"><a name="x5" href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><strong><percentage></strong></span></a></span>
</dt>
<dd>Specifies a percentage width. The percentage is calculated
with respect to the width of the generated box's
<a href="visuren.html#containing-block">containing block</a>.
<ins>If the containing block's width depends on this element's width, then
the resulting layout is undefined in CSS 2.1.</ins>
<span class="note">
<ins>Note: For absolutely positioned elements whose containing block is
based on a block container element, the percentage is calculated with
respect to the width of the</ins> <em><ins>padding box</ins></em> <ins>of that element.
This is a change from CSS1, where the percentage width was always
calculated with respect to the</ins> <em><ins>content box</ins></em> <ins>of the parent
element.</ins>
</span>
</dd>
<dt><strong>auto</strong>
</dt>
<dd>The width depends on the values of other properties.
See the sections below.
</dd>
</dl>
<p>Negative values for <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width">'width'</span></a> are
illegal.
</p>
<div class="example"><P style="display:none">Example(s):</P><p>
For example, the following rule fixes the content width of paragraphs
at 100 pixels:</p>
<pre>
p { width: 100px }
</pre>
</div>
<h2>10.3 <a name="Computing_widths_and_margins"> <del>Computing</del><ins>Calculating</ins> widths and
margins</a></h2>
<p>The <del>computed</del>values of an element's <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width">'width'</span></a>, <a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left">'margin-left'</span></a>, <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right">'margin-right'</span></a>, <a href="visuren.html#propdef-left" class="noxref"><span
class="propinst-left">'left'</span></a> and <a href="visuren.html#propdef-right" class="noxref"><span
class="propinst-right">'right'</span></a> properties <ins>as used for layout</ins>
depend on the type of box generated and on each other. <ins>(The value used
for layout is sometimes referred to as the</ins> <a
href="cascade.html#usedValue"><ins>used value</ins></a><ins>.)</ins> In
principle, the <del>computed</del>values <ins>used</ins> are the same as the <del>specified</del><ins>computed</ins> values, with
'auto' replaced by some suitable value, <ins>and percentages calculated
based on the containing block,</ins> but there are exceptions. The following
situations need to be distinguished:</p>
<ol>
<li>inline, non-replaced elements</li>
<li>inline, replaced elements</li>
<li>block-level, non-replaced elements in normal flow</li>
<li>block-level, replaced elements in normal flow</li>
<li>floating, non-replaced elements</li>
<li>floating, replaced elements</li>
<li>absolutely positioned, non-replaced elements</li>
<li>absolutely positioned, replaced elements</li>
<li> <del>Points 1-6 include relative positioning. 10.3.1 Inline,</del><ins>'inline-block',</ins> non-replaced elements <ins>in normal flow</ins></li>
<li><ins>'inline-block', replaced elements in normal flow</ins></li>
</ol>
<p><ins>For Points 1-6 and 9-10,</ins> the <del>'width' property does not apply. A specified value</del><ins>values</ins> of <del>'auto' for</del>'left' <del>,</del><ins>and</ins> 'right' <ins>in the
case of relatively positioned elements are determined by the rules in</ins> <a
href="visuren.html#relative-positioning"><ins>section 9.4.3.</ins></a>
</p>
<p class=note><em><strong><ins>Note.</ins></strong> <ins>The used value of 'width'
calculated below is a tentative value, and may have to be calculated
multiple times, depending on</ins> <a href="visudet.html#propdef-min-width" class="noxref"><span
class="propinst-min-width"><ins>'min-width'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-max-width" class="noxref"><span
class="propinst-max-width"><ins>'max-width'</ins></span></a>, <ins>see the section</ins> <a
href="#min-max-widths"><ins>Minimum and maximum widths</ins></a> <ins>below.</ins></em>
<h3><ins>10.3.1</ins> <a name="inline-width"><ins>Inline, non-replaced elements</ins></a></h3>
<p><ins>The</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>property does not
apply. A computed value of 'auto' for</ins> <a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left">'margin-left'</span></a> or <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right">'margin-right'</span></a> becomes a <del>computed</del><ins>used</ins>
value of '0'.
</p>
<h3>10.3.2 <a name="inline-replaced-width">Inline, replaced elements</a></h3>
<p>A <del>specified</del><ins>computed</ins> value of 'auto' for <a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left"> <del>'left' , 'right' ,</del>'margin-left'</span></a> or <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right">'margin-right'</span></a> becomes a <del>computed</del><ins>used</ins>
value of '0'.
<p> <del>A specified value</del><ins>If</ins> <a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height"><ins>'height'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"><ins>'width'</ins></span></a> <ins>both have computed values</ins> of
'auto' <del>for 'width' gives</del><ins>and</ins> the <del>element's</del><ins>element also has an intrinsic width, then that</ins>
intrinsic width <del>as the computed value. 10.3.3 Block-level, non-replaced elements in normal flow If 'left' or 'right' are given as 'auto', their computed value</del>is <del>0. The following constraints must hold between</del>the <del>other properties: 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width</del><ins>used value</ins> of <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"> <del>containing block (If the border style is 'none', use '0' as the border width.)</del><ins>'width'</ins></span></a><ins>.</ins>
<p>If <a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height"> <del>all</del><ins>'height'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"><ins>'width'</ins></span></a> <ins>both have computed values</ins> of
<ins>'auto' and</ins> the <del>above</del><ins>element has no intrinsic width, but does</ins> have <ins>an
intrinsic height and intrinsic ratio; or if</ins> <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"><ins>'width'</ins></span></a> <ins>has</ins> a <del>specified</del><ins>computed</ins> value <del>other than</del><ins>of</ins> 'auto',
<a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height"> <del>the values are said to be "over-constrained"</del><ins>'height'</ins></span></a> <ins>has some other computed
value,</ins> and <del>one of</del>the <del>computed values will</del><ins>element does</ins> have <del>to be different from its specified value.</del><ins>an intrinsic ratio; then the used
value of</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>is:</ins>
<blockquote><p><ins>(used height) * (intrinsic ratio)</ins></blockquote>
<p>If <ins>'height' and</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>both
have computed values of 'auto' and</ins> the <del>'direction' property</del><ins>element</ins> has <ins>an intrinsic ratio
but no intrinsic height or width, then</ins> the <del>value 'ltr', the specified</del><ins>used</ins> value of <del>'margin-right'</del><ins>'width'</ins> is
<del>ignored and the value</del><ins>undefined in CSS 2.1.
However, it</ins> is <del>computed so</del><ins>suggested that, if the containing block's width
does not itself depe
EF73
nd on the replaced element's width, then the used
value of 'width' is calculated from the constraint equation used for
block-level, non-replaced elements in normal flow.</ins>
<p><ins>Otherwise, if</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>has a
computed value of 'auto', and the element has an intrinsic width, then
that intrinsic width is the used value of</ins> <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"><ins>'width'</ins></span></a><ins>.</ins>
<p><ins>Otherwise, if</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>has a
computed value of 'auto', but none of the conditions above are met,
then the used value of</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a>
<ins>becomes 300px. If 300px is too wide to fit the device, UAs should use
the width of the largest rectangle that has a 2:1 ratio and fits the
device instead.</ins>
<h3><ins>10.3.3</ins> <a name="blockwidth"><ins>Block-level, non-replaced elements in normal
flow</ins></a></h3>
<p><ins>The following</ins> <a name="width-constraints"><ins>constraints</ins></a> <ins>must hold
among the used values of the other properties:</ins></p>
<blockquote>
<p><a href="box.html#propdef-margin-left" class="noxref"><span class="propinst-margin-left"><ins>'margin-left'</ins></span></a> <ins>+</ins> <a href="box.html#propdef-border-left-width" class="noxref"><span
class="propinst-border-left-width"><ins>'border-left-width'</ins></span></a> <ins>+</ins> <a href="box.html#propdef-padding-left" class="noxref"><span
class="propinst-padding-left"><ins>'padding-left'</ins></span></a> <ins>+</ins> <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"><ins>'width'</ins></span></a> <ins>+</ins> <a href="box.html#propdef-padding-right" class="noxref"><span
class="propinst-padding-right"><ins>'padding-right'</ins></span></a> <ins>+</ins> <a href="box.html#propdef-border-right-width" class="noxref"><span
class="propinst-border-right-width"><ins>'border-right-width'</ins></span></a> <ins>+</ins>
<a href="box.html#propdef-margin-right" class="noxref"><span class="propinst-margin-right"><ins>'margin-right'</ins></span></a> <ins>= width of</ins> <a
href="#containing-block-details"><ins>containing block</ins></a>
</p>
</blockquote>
<p><ins>If 'width' is not 'auto' and 'border-left-width' + 'padding-left' +
'width' + 'padding-right' + 'border-right-width' (plus any of
'margin-left' or 'margin-right' that are not 'auto') is larger than
the width of the containing block, then any 'auto' values for
'margin-left' or 'margin-right' are, for the following rules, treated
as zero.</ins>
</p>
<p><ins>If
all of the above have a computed value other than 'auto', the values
are said to be "over-constrained" and one of the used values will
have to be different from its computed value. If the</ins> <a href="visuren.html#propdef-direction" class="noxref"><span
class="propinst-direction"><ins>'direction'</ins></span></a>
<ins>property of the containing block has the value 'ltr', the specified
value of</ins> <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right"><ins>'margin-right'</ins></span></a> <ins>is ignored and the
value is calculated so</ins> as to make the equality true. If the value of
<a href="visuren.html#propdef-direction" class="noxref"><span class="propinst-direction">'direction'</span></a> is <del>'ltr',</del><ins>'rtl',</ins> this
happens to <a href="box.html#propdef-margin-left" class="noxref"><span class="propinst-margin-left">'margin-left'</span></a> instead.
</p>
<p>If there is exactly one value specified as 'auto', its <del>computed</del><ins>used</ins>
value follows from the equality.
</p>
<p>If <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width">'width'</span></a> is set to 'auto',
any other 'auto' values become '0' and <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width">'width'</span></a> follows from the resulting
equality.
</p>
<p>If both <a href="box.html#propdef-margin-left" class="noxref"><span class="propinst-margin-left">'margin-left'</span></a> and
<a href="box.html#propdef-margin-right" class="noxref"><span class="propinst-margin-right">'margin-right'</span></a> are 'auto',
their <del>computed</del><ins>used</ins> values are equal. <ins>This horizontally centers the element
with respect to the edges of the containing block.</ins>
</p>
<h3>10.3.4 <a name="block-replaced-width">Block-level, replaced elements in normal flow</a></h3>
<p> <del>If 'left' or 'right' are 'auto', their computed</del><ins>The used</ins> value <del>is 0. If</del><ins>of</ins>
<a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width">'width'</span></a> is <del>specified</del><ins>determined</ins>
as <del>'auto', its value is the element's intrinsic width. If one of the margins is 'auto', its computed value is given by</del><ins>for</ins> <a href="#inline-replaced-width"><ins>inline replaced
elements</ins></a><ins>.
Then</ins> the <del>constraints above. Furthermore, if both margins are 'auto', their computed values</del><ins>rules</ins> <a href="#blockwidth"><ins>for non-replaced
block-level elements</ins></a> are <del>equal.</del><ins>applied to determine the margins.</ins>
</p>
<h3>10.3.5 <a name="float-width">Floating, non-replaced elements</a></h3>
<p>If <a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left"> <del>'left' , 'right' , 'width' ,</del>'margin-left'</span></a>, or <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right">'margin-right'</span></a> are <del>specified</del><ins>computed</ins> as
'auto', their <del>computed</del><ins>used</ins> value is '0'.
</p>
<p><ins>If</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>is computed as
'auto', the used value is the "shrink-to-fit" width.</ins>
</p>
<p><a name="shrink-to-fit-float"></a> <ins>Calculation of the shrink-to-fit
width is similar to calculating the width of a table cell using the
automatic table layout algorithm. Roughly: calculate the preferred
width by formatting the content without breaking lines other than
where explicit line breaks occur, and also calculate the preferred</ins>
<em><ins>minimum</ins></em> <ins>width, e.g., by trying all possible line breaks.
CSS 2.1 does not define the exact algorithm. Thirdly, find the</ins>
<em><ins>available width</ins></em><ins>: in this case, this is the width of the
containing block minus the used values of 'margin-left',
'border-left-width', 'padding-left', 'padding-right',
'border-right-width', 'margin-right', and the widths of any relevant
scroll bars.</ins>
</p>
<p><ins>Then the shrink-to-fit width is: min(max(preferred minimum width,
available width), preferred width).</ins></p>
<h3>10.3.6 <a name="float-replaced-width">Floating, replaced elements</a></h3>
<p>If <a href="box.html#propdef-margin-left" class="noxref"><span class="propinst-margin-left"> <del>'left' , 'right' ,</del>'margin-left'</span></a> or <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right">'margin-right'</span></a> are <del>specified</del><ins>computed</ins> as
'auto', their <del>computed</del><ins>used</ins> value is '0'. <del>If 'width' is 'auto', its</del><ins>The used</ins> value <ins>of</ins> <a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"><ins>'width'</ins></span></a> is <del>the element's intrinsic width.</del><ins>determined as for</ins> <a
href="#inline-replaced-width"><ins>inline replaced elements</ins></a><ins>.</ins>
</p>
<h3>10.3.7 <a name="abs-non-replaced-width">Absolutely positioned, non-replaced elements</a></h3>
<p> <del>The constraint that determines the computed values</del>For <del>these elements is: 'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block (If</del>the <del>border style is 'none', use '0' as</del><ins>purposes of this section and</ins> the <del>border width.)</del><ins>next,</ins> the <del>solution</del><ins>term</ins> <a
name=static-position><span class=index><ins>"static position"</ins></span></a>
<ins>(of an element) refers, roughly,</ins>
to <del>this constraint is reached through a number of substitutions</del><ins>the position an element would have had</ins> in the <del>following order: If 'left' has</del><ins>normal flow. More
precisely:</ins>
</p>
<ul>
<li>The <dfn> <del>value 'auto' while 'direction'</del><ins>static-position containing block</ins></dfn> is <del>'ltr', replace 'auto' with the distance from the left edge of</del>the containing
block <del>to the left margin edge</del>of a hypothetical box that would have been the first box of the
element if its <ins>specified</ins> <a href="visuren.html#propdef-position" class="noxref"><span
class="propinst-position">'position'</span></a> <del>property</del><ins>value</ins> had been <del>'static'. (But rather than actually computing</del><ins>'static'
and its specified 'float' had been 'none'. (Note</ins> that <del>box, user agents are free</del><ins>due</ins> to <del>make</del><ins>the rules
in</ins> <a href="visuren.html#dis-pos-flo"><ins>section 9.7</ins></a> <ins>this
hypothetical calculation might require also assuming</ins> a <del>guess at</del><ins>different
computed value for 'display'.)</ins>
</li>
<li><ins>The static position for 'left' is the distance from the left edge
of the containing block to the left margin edge of a hypothetical box
that would have been the first box of the element if</ins> its <a href="visuren.html#propdef-position" class="noxref"><span
class="propinst-position"> <del>probable position.)</del><ins>'position'</ins></span></a> <ins>property had been 'static'
and</ins> <a href="visuren.html#propdef-float" class="noxref"><span class="propinst-float"><ins>'float'</ins></span></a> <ins>had been 'none'.</ins> The
value is negative if the hypothetical
box is to the left of the containing block.
</li>
<li> <del>If 'right' has</del>The <del>value 'auto' while 'direction'</del><ins>static position for 'right'</ins> is <del>'rtl', replace 'auto' with</del>the distance from the right
edge of the containing block to the right margin edge of the same
hypothetical box as above. The value is positive if the hypothetical
box is to the left of the containing block's edge.
</li>
</ul>
<p> <del>If 'width'</del><ins>But rather than actually calculating the dimensions of that
hypothetical box, user agents are free to make a guess at its probable
position.</ins>
</p>
<p><ins>For the purposes of calculating the static position, the containing
block of fixed positioned elements</ins> is <del>'auto', replace any remaining 'auto'</del><ins>the initial containing block
instead of the viewport, and all scrollable boxes should be assumed to
be scrolled to their origin.</ins>
<p><ins>The constraint that determines the used values</ins> for <ins>these
elements is:</ins></p>
<blockquote>
<p>'left' <del>or</del><ins>+ 'margin-left' + 'border-left-width' + 'padding-left' + 'width'
+ 'padding-right' + 'border-right-width' + 'margin-right' +</ins> 'right' <del>with '0'.</del><ins>= width
of containing block</ins> </p>
</blockquote>
<p>If <del>'left' ,</del><ins>all three of 'left', 'width', and</ins> 'right' <del>or 'width'</del>are <del>(still) 'auto', replace</del><ins>'auto': First set</ins>
any 'auto' <del>on</del><ins>values for</ins> 'margin-left' <del>or</del><ins>and</ins> 'margin-right' <del>with '0'.</del><ins>to 0. Then, if
the 'direction' property of the element establishing the
static-position containing block is 'ltr' set 'left'
to the</ins> <a
href="#static-position"><ins>static position</ins></a> <ins>and apply rule number
three below; otherwise, set 'right' to the</ins> <a
href="#static-position"><ins>static position</ins></a> <ins>and apply rule number
one below.</ins></p>
<p><ins>If none of the three is 'auto':</ins> If <del>at this point</del>both 'margin-left' and
'margin-right' are <del>still</del>'auto', solve the
equation under the extra constraint that the two margins <del>must</del>get equal
<del>values. If at</del><ins>values, unless</ins> this <del>point there</del><ins>would make them negative, in which case when
direction of the containing block</ins> is <del>only</del><ins>'ltr' ('rtl'), set 'margin-left'
('margin-right') to zero
and solve for 'margin-right' ('margin-left'). If</ins> one <del>'auto' left,</del><ins>of
'margin-left' or 'margin-right' is 'auto',</ins> solve the equation for that
value. If <del>at this point</del>the values are over-constrained, ignore the value for <del>either</del>'left'
(in case <ins>the</ins> 'direction' <ins>property of the containing block</ins> is 'rtl') or
'right' (in case 'direction' is
'ltr') and solve for that value.</p>
<p> <del>10.3.8 Absolutely positioned, replaced elements This situation is similar</del><ins>Otherwise, set 'auto' values for 'margin-left' and 'margin-right'</ins>
to <ins>0, and pick</ins> the <del>previous one, except that the element has an intrinsic width. The sequence</del><ins>one</ins> of <del>substitutions is now: If</del><ins>the following six rules that applies.</ins></p>
<ol>
<li><ins>'left' and</ins> 'width' <ins>are 'auto' and 'right'</ins> is <ins>not</ins> 'auto', <del>substitute</del><ins>then</ins> the
<del>element's intrinsic width. If</del><ins>width is shrink-to-fit. Then solve for</ins> 'left'</li>
<li> <del>has the value</del><ins>'left' and 'right' are</ins> 'auto' <del>while 'direction'</del><ins>and 'width'</ins> is <del>'ltr', replace 'auto' with the distance from</del><ins>not 'auto', then if</ins>
the <del>left edge</del><ins>'direction' property</ins> of the <ins>element establishing the
static-position</ins> containing block <ins>is 'ltr' set 'left'</ins>
to the <a
href="#static-position"> <del>left margin edge of a hypothetical box that would have been the first box of the element if its 'position' property had been 'static'. (But rather than actually computing that box, user agents are free</del><ins>static position</ins></a><ins>, otherwise set 'right'</ins>
to <del>make a guess at its probable position.)</del>the <a href="#static-position"> <del>value is negative if the hypothetical box</del><ins>static position</ins></a><ins>. Then solve
for 'left' (if 'direction</ins> is <del>to the left of the containing block. If</del><ins>'rtl') or</ins> 'right' <del>has the value 'auto' while</del><ins>(if</ins> 'direction' is
<del>'rtl', replace</del><ins>'ltr').</ins></li>
<li><ins>'width' and 'right' are</ins> 'auto' <del>with the distance from the right edge of the containing block to the right margin edge of the same hypothetical box as above. The value</del><ins>and 'left'</ins> is <del>positive if</del><ins>not 'auto', then</ins> the
<del>hypothetical box</del><ins>width</ins> is <del>to the left of the containing block's edge. If 'left' or</del><ins>shrink-to-fit . Then solve for</ins> 'right'</li>
<li> <del>are</del><ins>'left' is</ins> 'auto', <del>replace any 'auto' on 'margin-left' or 'margin-right' with '0'. If at this point both 'margin-left'</del><ins>'width'</ins> and <del>'margin-right'</del><ins>'right'</ins> are <del>still</del><ins>not 'auto', then solve for
'left'</ins></li>
<li><ins>'width' is 'auto', 'left' and 'right' are not 'auto', then solve
for 'width'</ins></li>
<li><ins>'right' is 'auto', 'left' and 'width' are not 'auto', then solve
for 'right'</ins></li>
</ol>
<p><ins>Calculation of the shrink-to-fit width is similar to calculating
the width of a table cell using the automatic table layout algorithm.
Roughly: calculate the preferred width by formatting the content
without breaking lines other than where explicit line breaks occur,
and also calculate the preferred</ins> <em><ins>minimum</ins></em> <ins>width, e.g., by
trying all possible line breaks. CSS 2.1 does not define the
exact algorithm. Thirdly, calculate the</ins> <em><ins>available width</ins></em><ins>: this
is found by solving for 'width' after setting 'left' (in case 1) or
'right' (in case 3) to 0.</ins></p>
<p><ins>Then the shrink-to-fit width is: min(max(preferred minimum width, available
width), preferred width).</ins></p>
<h3><ins>10.3.8</ins> <a name="abs-replaced-width"><ins>Absolutely positioned, replaced elements</ins></a></h3>
<p><ins>In this case,</ins> <a href="#abs-non-replaced-width"><ins>section 10.3.7</ins></a>
<ins>applies up through and including the constraint equation, but the rest
of</ins> <a href="#abs-non-replaced-width"><ins>section 10.3.7</ins></a> <ins>is replaced by
the following rules:</ins>
<ol>
<li><ins>The used value of</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>is
determined as for</ins> <a href="#inline-replaced-width"><ins>inline replaced
elements</ins></a><ins>.
If</ins> <a href="box.html#propdef-margin-left" class="noxref"><span class="propinst-margin-left"><ins>'margin-left'</ins></span></a> <ins>or</ins> <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right"><ins>'margin-right'</ins></span></a> <ins>is specified as
'auto' its used value is determined by the rules below.</ins>
</li>
<li><ins>If both</ins> <a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left"><ins>'left'</ins></span></a> <ins>and</ins> <a href="visuren.html#propdef-right" class="noxref"><span
class="propinst-right"><ins>'right'</ins></span></a> <ins>have the value 'auto', then if
the 'direction' property of the element establishing the
static-position containing block is 'ltr', set</ins> <a href="visuren.html#propdef-left" class="noxref"><span
class="propinst-left"><ins>'left'</ins></span></a> <ins>to
the static position; else if 'direction' is 'rtl', set</ins> <a href="visuren.html#propdef-right" class="noxref"><span
class="propinst-right"><ins>'right'</ins></span></a> <ins>to the static position.</ins>
</li>
<li><ins>If</ins> <a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left"><ins>'left'</ins></span></a> <ins>or</ins> <a href="visuren.html#propdef-right" class="noxref"><span
class="propinst-right"><ins>'right'</ins></span></a> <ins>are 'auto', replace any 'auto'
on</ins> <a href="box.html#propdef-margin-left" class="noxref"><span class="propinst-margin-left"><ins>'margin-left'</ins></span></a> <ins>or</ins> <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right"><ins>'margin-right'</ins></span></a> <ins>with '0'.</ins>
</li>
<li><ins>If at this point both</ins> <a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left"><ins>'margin-left'</ins></span></a> <ins>and</ins> <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right"><ins>'margin-right'</ins></span></a> <ins>are still</ins> 'auto',
solve the equation under the extra constraint that the two margins
must get equal <del>values.</del><ins>values, unless this would make them negative, in which
case when the direction of the containing block is 'ltr' ('rtl'), set</ins>
<a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left"><ins>'margin-left'</ins></span></a> <ins>(</ins><a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right"><ins>'margin-right'</ins></span></a><ins>) to zero and solve
for</ins> <a href="box.html#propdef-margin-right" class="noxref"><span class="propinst-margin-right"><ins>'margin-right'</ins></span></a> <ins>(</ins><a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left"><ins>'margin-left'</ins></span></a><ins>).</ins>
</li>
<li>If at this point there is <del>only one</del><ins>an</ins> 'auto' left, solve the equation
for that value.
</li>
<li>If at this point the values are over-constrained, ignore the value
for either <a href="visuren.html#propdef-left" class="noxref"><span class="propinst-left">'left'</span></a> (in case <ins>the</ins>
<a href="visuren.html#propdef-direction" class="noxref"><span class="propinst-direction">'direction'</span></a> <ins>property of the
containing block</ins> is 'rtl') or <a href="visuren.html#propdef-right" class="noxref"><span
class="propinst-right">'right'</span></a> (in case <a href="visuren.html#propdef-direction" class="noxref"><span
class="propinst-direction">'direction'</span></a> is 'ltr') and solve for
that value.
</li>
</ol>
<h3> <del>10.4 Minimum and maximum widths : 'min-width' and 'max-width' 'min-width' Value: <length> | <percentage> |</del><ins>10.3.9</ins> <a name="inlineblock-width"><ins>'Inline-block', non-replaced elements in normal flow</ins></a></h3>
<p><ins>If</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a> <ins>is 'auto', the
used value is the</ins> <a href="#shrink-to-fit-float"><ins>shrink-to-fit</ins></a>
<ins>width as for floating elements.</ins>
</p>
<p><ins>A computed value of 'auto' for</ins> <a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left"><ins>'margin-left'</ins></span></a> <ins>or</ins> <a href="box.html#propdef-margin-right" class="noxref"><span
class="propinst-margin-right"><ins>'margin-right'</ins></span></a> <ins>becomes a used
value of '0'.</ins>
</p>
<h3><ins>10.3.10</ins> <a name="inlineblock-replaced-width"><ins>'Inline-block', replaced elements in normal flow</ins></a></h3>
<p><ins>Exactly as</ins> <a href="#inline-replaced-width"><ins>inline replaced
elements.</ins></a>
</p>
<h2><ins>10.4</ins> <a name="min-max-widths"><ins>Minimum and maximum widths</ins></a><ins>:</ins> <a href="visudet.html#propdef-min-width" class="noxref"><span
class="propinst-min-width"><ins>'min-width'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-max-width" class="noxref"><span
class="propinst-max-width"><ins>'max-width'</ins></span></a></h2>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'min-width'"><a name="propdef-min-width" class="propdef-title"><strong><ins>'min-width'</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>|</ins> <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> <del>UA dependent</del><ins>0</ins>
<tr valign=baseline><td><em>Applies to:</em> <td>all elements <del>except</del><ins>but</ins> non-replaced inline <del>elements and</del><ins>elements,</ins> table <del>elements</del><ins>rows, and row groups</ins>
<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><ins>Computed value:</ins></em><ins> </ins><td><ins>the percentage as specified or the absolute length</ins>
</table>
</dl>
</div>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'max-width'"><a name="propdef-max-width" class="propdef-title"><strong>'max-width'</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> | 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>none
<tr valign=baseline><td><em>Applies to:</em> <td>all elements <del>except</del><ins>but</ins> non-replaced inline <del>elements and</del><ins>elements,</ins> table <del>elements</del><ins>rows, and row groups</ins>
<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><ins>Computed value:</ins></em><ins> </ins><td><ins>the percentage as specified or the absolute length or 'none'</ins>
</table>
</dl>
</div>
<p>These two properties allow authors to constrain <del>box</del><ins>content</ins> widths to a
certain range. Values have the following meanings:</p>
<dl>
<dt><span class="index-inst" title="<length>"><a name="x8" href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><strong><length></strong></span></a></span>
</dt>
<dd>Specifies a fixed minimum or maximum <del>computed</del><ins>used</ins> width.
</dd>
<dt><span class="index-inst" title="<percentage>"><a name="x9" href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><strong><percentage></strong></span></a></span>
</dt>
<dd>Specifies a percentage for determining the <del>computed</del><ins>used</ins> value. The
percentage is calculated with respect to the width of the generated
box's <a href="visuren.html#containing-block">containing block</a>.
<ins>If the containing block's width is negative, the used value is
zero.
If the containing block's width depends on this element's width,
then the resulting layout is undefined in CSS 2.1.</ins>
</dd>
<dt><strong>none</strong>
</dt>
<dd>(Only on <a href="visudet.html#propdef-max-width" class="noxref"><span class="propinst-max-width">'max-width'</span></a>) No
limit on the width of the box.
</dd>
</dl>
<p><ins>Negative values for</ins> <a href="visudet.html#propdef-min-width" class="noxref"><span
class="propinst-min-width"><ins>'min-width'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-max-width" class="noxref"><span
class="propinst-max-width"><ins>'max-width'</ins></span></a> <ins>are illegal.</ins>
</p>
<p><ins>In CSS 2.1, the effect of 'min-width' and 'max-width' on
tables, inline tables,
table cells, table columns, and column groups is undefined.</ins>
<p>The following algorithm describes how the two properties influence
the <a href="cascade.html#computed-value"> <del>computed</del><ins>used</ins> value</a>
of the <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width">'width'</span></a> property:</p>
<ol>
<li>The <ins>tentative used</ins> width is <del>computed</del><ins>calculated</ins> (without <a href="visudet.html#propdef-min-width" class="noxref"><span
class="propinst-min-width">'min-width'</span></a> and <a href="visudet.html#propdef-max-width" class="noxref"><span
class="propinst-max-width">'max-width'</span></a>) following the rules
under <a href="#Computing_widths_and_margins"> <del>"Computing</del><ins>"Calculating</ins> widths and
margins"</a> above.
</li>
<li>If the <del>computed value of 'min-width' is greater than the value of 'max-width' , 'max-width' is set to the value of 'min-width' . If the computed</del><ins>tentative used</ins> width is greater than <a href="visudet.html#propdef-max-width" class="noxref"><span
class="propinst-max-width">'max-width'</span></a>, the rules <a
href="#Computing_widths_and_margins">above</a> are applied again, but
this time using the <ins>computed</ins> value of <a href="visudet.html#propdef-max-width" class="noxref"><span
class="propinst-max-width">'max-width'</span></a> as the <del>specified</del><ins>computed</ins> value
for <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width">'width'</span></a>.
</li>
<li>If the <del>computed</del><ins>resulting</ins> width is smaller than <a href="visudet.html#propdef-min-width" class="noxref"><span
class="propinst-min-width">'min-width'</span></a>, the rules <a
href="#Computing_widths_and_margins">above</a> are applied again, but
this time using the value of <a href="visudet.html#propdef-min-width" class="noxref"><span
class="propinst-min-width">'min-width'</span></a> as the <del>specified</del><ins>computed</ins> value
for <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width">'width'</span></a>.
</li>
</ol>
<p class="note"><ins>These steps do not affect</ins> the <del>user agent may define a non-negative minimum value for</del><ins>real computed values of</ins>
the <del>'min-width' property, which may vary from element to element and even depend on other</del><ins>above</ins> properties.</p>
<p> <del>If 'min-width' goes below this limit, either because it was set explicitly, or because it was 'auto'</del><ins>However, for replaced elements with an intrinsic ratio</ins> and <del>the rules below would make it too small, the user agent may use the minimum value</del><ins>both</ins>
<a href="visudet.html#propdef-width" class="noxref"><span
class="propinst-width"><ins>'width'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-height" class="noxref"><span
class="propinst-height"><ins>'height'</ins></span></a> <ins>specified</ins> as <ins>'auto',</ins> the
<ins>algorithm is as follows:</ins>
</p>
<p><ins>Select from the table the resolved height and width values for the
appropriate constraint violation. Take the</ins> <var><ins>max-width</ins></var> <ins>and</ins>
<var><ins>max-height</ins></var> <ins>as max(min, max) so that</ins> <var><ins>min</ins></var> <ins>≤</ins>
<var><ins>max</ins></var> <ins>holds true.
In this table</ins> <var><ins>w</ins></var> <ins>and</ins> <var><ins>h</ins></var> <ins>stand for the results of
the width and height computations ignoring the</ins> <a href="visudet.html#propdef-min-width" class="noxref"><span
class="propinst-min-width"><ins>'min-width'</ins></span></a><ins>,</ins> <a href=&quo
63D1
t;visudet.html#propdef-min-height" class="noxref"><span
class="propinst-min-height"><ins>'min-height'</ins></span></a><ins>,</ins> <a href="visudet.html#propdef-max-width" class="noxref"><span
class="propinst-max-width"><ins>'max-width'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-max-height" class="noxref"><span
class="propinst-max-height"><ins>'max-height'</ins></span></a> <ins>properties. Normally
these are the intrinsic width and height, but they may not be in the
case of replaced elements with intrinsic ratios.</ins>
<p class=note><ins>Note: In cases where an explicit width or height is
set and the other dimension is auto, applying a minimum or maximum
constraint on the auto side can cause an over-constrained situation.
The spec is clear in the behavior but it might not be what the author
expects. The CSS3 object-fit property can be used to obtain different
results in this situation.</ins>
<table rules=all>
<thead>
<tr><th><ins>Constraint Violation</ins></th><th><ins>Resolved Width</ins></th><th><ins>Resolved Height</ins></th></tr>
</thead>
<tbody>
<tr><td><ins>none</ins></td>
<td><var><ins>w</ins></var></td>
<td><var><ins>h</ins></var></td></tr>
<tr><td><var><ins>w > max-width</ins></var></td>
<td><var><ins>max-width</ins></var></td>
<td><var><ins>max(max-width * h/w, min-height)</ins></var></td></tr>
<tr><td><var><ins>w < min-width</ins></var></td>
<td><var><ins>min-width</ins></var></td>
<td><var><ins>min(min-width * h/w, max-height)</ins></var></td></tr>
<tr><td><var><ins>h > max-height</ins></var></td>
<td><var><ins>max(max-height * w/h, min-width)</ins></var></td>
<td><var><ins>max-height</ins></var></td></tr>
<tr><td><var><ins>h < min-height</ins></var></td>
<td><var><ins>min(min-height * w/h, max-width)</ins></var></td>
<td><var><ins>min-height</ins></var></td></tr>
<tr><td><ins>(</ins><var><ins>w > max-width</ins></var><ins>) and (</ins><var><ins>h > max-height</ins></var><ins>), where (</ins><var><ins>max-width/w ≤ max-height/h</ins></var><ins>)</ins></td>
<td><var><ins>max-width</ins></var></td>
<td><var><ins>max(min-height, max-width * h/w)</ins></var></td></tr>
<tr><td><ins>(</ins><var><ins>w > max-width</ins></var><ins>) and (</ins><var><ins>h > max-height</ins></var><ins>), where (</ins><var><ins>max-width/w > max-height/h</ins></var><ins>)</ins></td>
<td><var><ins>max(min-width, max-height * w/h)</ins></var></td>
<td><var><ins>max-height</ins></var></td></tr>
<tr><td><ins>(</ins><var><ins>w < min-width</ins></var><ins>) and (</ins><var><ins>h < min-height</ins></var><ins>), where (</ins><var><ins>min-width/w ≤ min-height/h</ins></var><ins>)</ins></td>
<td><var><ins>min(max-width, min-height * w/h)</ins></var></td>
<td><var><ins>min-height</ins></var></td></tr>
<tr><td><ins>(</ins><var><ins>w < min-width</ins></var><ins>) and (</ins><var><ins>h < min-height</ins></var><ins>), where (</ins><var><ins>min-width/w > min-height/h</ins></var><ins>)</ins></td>
<td><var><ins>min-width</ins></var></td>
<td><var><ins>min(max-height, min-width * h/w)</ins></var></td></tr>
<tr><td><ins>(</ins><var><ins>w < min-width</ins></var><ins>) and (</ins><var><ins>h > max-height</ins></var><ins>)</ins></td>
<td><var><ins>min-width</ins></var></td>
<td><var><ins>max-height</ins></var></td></tr>
<tr><td><ins>(</ins><var><ins>w > max-width</ins></var><ins>) and (</ins><var><ins>h < min-height</ins></var><ins>)</ins></td>
<td><var><ins>max-width</ins></var></td>
<td><var><ins>min-height</ins></var></td></tr>
</tbody>
</table>
<p><ins>Then apply the rules under</ins> <a
href="#Computing_widths_and_margins"><ins>"Calculating widths and
margins"</ins></a> <ins>above, as if</ins> <a href="visudet.html#propdef-width" class="noxref"><span class="propinst-width"><ins>'width'</ins></span></a>
<ins>were</ins> computed <ins>as this</ins> value.
<h2>10.5 <a name="the-height-property">Content height</a>: the <a href="visudet.html#propdef-height" class="noxref"><span
class="propinst-height">'height'</span></a> property</h2>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'height'"><a name="propdef-height" class="propdef-title"><strong>'height'</strong></a></span>
<dd>
&
A7EF
lt;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>all elements but non-replaced inline elements, table columns, and column groups
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>see prose
<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>the percentage or 'auto' (as specified) or the absolute length</ins>
</table>
</dl>
</div>
<p> This property specifies the <a
href="box.html#content-height">content height</a> of <del>boxes generated by block-level and replaced elements.</del><ins>boxes.</ins>
<p>This property does not apply to non-replaced <a
href="visuren.html#inline-boxes"> <del>inline-level</del><ins>inline</ins></a> elements. <ins>See</ins> the <a
href="#inline-non-replaced"> <del>height of a</del><ins>section on computing heights and margins
for</ins> non-replaced inline <del>element's boxes is given by</del><ins>elements</ins></a> <ins>for</ins> the <del>element's (possibly inherited) 'line-height' value.</del><ins>rules used instead.</ins>
</p>
<p>Values have the following meanings:</p>
<dl>
<dt><span class="index-inst" title="<length>"><a name="x11" href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><strong><length></strong></span></a></span>
</dt>
<dd>Specifies <ins>the height of the content area using</ins> a <del>fixed height.</del><ins>length value.</ins>
</dd>
<dt><span class="index-inst" title="<percentage>"><a name="x12" href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><strong><percentage></strong></span></a></span>
</dt>
<dd>Specifies a percentage height. The percentage is calculated with
respect to the height of the generated box's <a
href="visuren.html#containing-block">containing block</a>. If the
height of the containing block is not specified explicitly (i.e., it
depends on content height), <ins>and this element is not absolutely
positioned,</ins> the value <del>is interpreted like</del><ins>computes to</ins> 'auto'. <del>auto The</del><ins>A percentage</ins> height
<del>depends</del>on the <a href="conform.html#root"> <del>values of other properties. See</del><ins>root element</ins></a> <ins>is relative to</ins> the
<a href="#containing-block-details"> <del>prose below. Negative values for 'height' are illegal. Example(s):</del><ins>initial containing block</ins></a><ins>.</ins>
<span class="note">
<ins>Note:</ins> For <del>example, the following rule fixes the height of paragraphs to 100 pixels:</del><ins>absolutely positioned elements whose containing block is
based on a block-level element, the percentage is calculated with
respect to the height of the</ins> <em><ins>padding box</ins></em> <ins>of that element.
This is a change from CSS1, where the percentage was always
calculated with respect to the</ins> <em><ins>content box</ins></em> <ins>of the parent
element.</ins>
</span>
</dd>
<dt><strong><ins>auto</ins></strong>
</dt>
<dd><ins>The height depends on the values of other properties.
See the prose below.</ins>
</dd>
</dl>
<p class="note"><ins>Note that the height of the containing block of an
absolutely positioned element is independent of the size of the
element itself, and thus a percentage height on such an element can
always be resolved. However, it may be that the height is not known
until elements that come later in the document have been processed.</ins>
</p>
<p><ins>Negative values for</ins> <a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height"><ins>'height'</ins></span></a>
<ins>are illegal.</ins>
</p>
<div class="example"><P style="display:none"><ins>Example(s):</ins></P><p>
<ins>For example, the following rule sets the content height of paragraphs
to 100 pixels:</ins></p>
<pre>
p { height: 100px }
</pre>
<p>Paragraphs <del>that require more than 100 pixels</del>of <ins>which the</ins> height <ins>of the contents exceeds 100 pixels</ins>
will <a href="visufx.html#overflow">overflow</a> according to the
<a href="visufx.html#propdef-overflow" class="noxref"><span class="propinst-overflow">'overflow'</span></a> property.
</p>
</div>
<h2>10.6 <a name="Computing_heights_and_margins"> <del>Computing</del><ins>Calculating</ins> heights and
margins</a></h2>
<p>For <del>computing</del><ins>calculating</ins> the values of <a href="visuren.html#propdef-top" class="noxref"><span class="propinst-top">'top'</span></a>, <a href="box.html#propdef-margin-top" class="noxref"><span class="propinst-margin-top">'margin-top'</span></a>, <a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height">'height'</span></a>,
<a href="box.html#propdef-margin-bottom" class="noxref"><span class="propinst-margin-bottom">'margin-bottom'</span></a>, and <a href="visuren.html#propdef-bottom" class="noxref"><span class="propinst-bottom">'bottom'</span></a> a distinction must be made between
various kinds of boxes:
</p>
<ol>
<li>inline, non-replaced elements</li>
<li>inline, replaced elements</li>
<li>block-level, non-replaced elements in normal flow</li>
<li>block-level, replaced elements in normal flow</li>
<li>floating, non-replaced elements</li>
<li>floating, replaced elements</li>
<li>absolutely positioned, non-replaced elements</li>
<li>absolutely positioned, replaced elements</li>
<li> <del>Points 1-6 include relative positioning. 10.6.1 Inline,</del><ins>'inline-block',</ins> non-replaced elements <del>If</del><ins>in normal flow</ins></li>
<li><ins>'inline-block', replaced elements in normal flow</ins></li>
</ol>
<p><ins>For Points 1-6 and 9-10, the used values of</ins> 'top' <del>,</del><ins>and</ins>
'bottom' <del>, 'margin-top' , or 'margin-bottom'</del>are <del>'auto', their computed</del><ins>determined by the rules in section 9.4.3.</ins>
</p>
<p class=note><ins>Note: these rules apply to
the root element just as to any other element.</ins>
<p class=note><em><strong><ins>Note.</ins></strong> <ins>The used</ins> value <ins>of 'height'
calculated below</ins> is <del>0.</del><ins>a tentative value, and may have to be calculated
multiple times, depending on</ins> <a href="visudet.html#propdef-min-height" class="noxref"><span
class="propinst-min-height"><ins>'min-height'</ins></span></a> <ins>and</ins> <a href="visudet.html#propdef-max-height" class="noxref"><span
class="propinst-max-height"><ins>'max-height'</ins></span></a><ins>, see the section</ins> <a
href="#min-max-heights"><ins>Minimum and maximum heights</ins></a> <ins>below.</ins></em>
<h3><ins>10.6.1</ins> <a name="inline-non-replaced"><ins>Inline, non-replaced elements</ins></a></h3>
<p>The <a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height">'height'</span></a> property <del>doesn't apply, but</del><ins>does not
apply.</ins> The height of the <del>box is given by</del><ins>content area should be based on</ins> the <del>'line-height' property. 10.6.2 Inline, replaced elements block-level, replaced elements in normal flow, and floating, replaced elements If 'top' , 'bottom' , 'margin-top' ,</del><ins>font, but
this specification does not specify how. A UA may, e.g., use the
em-box</ins> or <del>'margin-bottom' are 'auto',</del><ins>the maximum ascender and descender of the font. (The latter
would ensure that glyphs with parts above or below the em-box still
fall within the content area, but leads to differently sized boxes for
different fonts; the former would ensure authors can control
background styling relative to the 'line-height', but leads to glyphs
painting outside</ins> their <del>computed value</del><ins>content area.)</ins>
</p>
<p class=note><ins>Note: level 3 of CSS will probably include a property to
select which measure of the font</ins> is <del>0.</del><ins>used for the content height.</ins>
</p>
<p><ins>The vertical padding, border and margin of an inline, non-replaced
box start at the top and bottom of the content area, and has nothing
to do with the</ins> <a href="visudet.html#propdef-line-height" class="noxref"><span
class="propinst-line-height"><ins>'line-height'</ins></span></a><ins>. But only the</ins> <a href="visudet.html#propdef-line-height" class="noxref"><span
class="propinst-line-height"><ins>'line-height'</ins></span></a> <ins>is used when calculating