-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathvisudet.src
More file actions
1461 lines (1145 loc) · 53.4 KB
/
visudet.src
File metadata and controls
1461 lines (1145 loc) · 53.4 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.0 Transitional//EN">
<html lang="en">
<!-- $Id: visudet.src,v 1.32 1997-12-28 23:26:14 ijacobs Exp $ -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Visual rendering model details</TITLE>
<LINK rel="next" href="generate.html">
<LINK rel="previous" href="flowobj.html">
<LINK rel="STYLESHEET" href="style/default.css" type="text/css">
</HEAD>
<BODY>
<H1 align="center">Visual rendering model details</H1>
<H2>Box model properties</h2>
<H3><a name="margin-properties">Margin properties</a>:
<span class="propinst-margin-top">'margin-top'</span>,
<span class="propinst-margin-right">'margin-right'</span>,
<span class="propinst-margin-bottom">'margin-bottom'</span>,
<span class="propinst-margin-left">'margin-left'</span>, and
<span class="propinst-margin">'margin'</span></H3>
<P>Margin properties set the margin of an element. The
<span class="propinst-margin">'margin'</span> property sets the border
for all four sides while the other margin properties only set their
respective side.
<H4><a name="border-width-defs">Values for </a><span class="index-def"
title="<margin-width>::definition of"><a
name="value-def-margin-width"><margin-width></a></span></H4>
<P>The properties defined in this section refer to the
<span class="value-inst-margin-width"><margin-width></span>
value type, whose possible values may be:
<P><span class="value-inst-length"><length></span> |
<span class="value-inst-percentage"><percentage></span> |
auto</P>
<P>Negative values for margin properties are allowed, but there may be
implementation-specific limits.
<P>Percentage values for margin properties refer to the width of
the containing block.
<!-- #include src=properties/margin-top.srb -->
<P>This property sets the top margin of an element. It applies to
replaced and block-level elements.
<div class="example"><P>
<PRE>
H1 { margin-top: 2em }
</PRE>
</div>
<!-- #include src=properties/margin-right.srb -->
<P>This property sets the right margin of an element:
<div class="example"><p>
<PRE>
H1 { margin-right: 12.3% }
</PRE>
</div>
<!-- #include src=properties/margin-bottom.srb -->
<P> This property sets the bottom margin of an element. It applies to
replaced and block-level elements.
<div class="example"><P>
<PRE>
H1 { margin-bottom: 3px }
</PRE>
</div>
<!-- #include src=properties/margin-left.srb -->
<P> This property sets the left margin of an element:
<div class="example"><P>
<PRE>
H1 { margin-left: 2em }
</PRE>
</div>
<!-- #include src=properties/margin.srb -->
<P> The <span class="propinst-margin">'margin'</span> property is a shorthand
property for setting <span class="propinst-margin-top">'margin-top'</span>, <span
class="propinst-margin-right">'margin-right'</span> <span
class="propinst-margin-bottom">'margin-bottom'</span> and <span
class="propinst-margin-left">'margin-left'</span> at the same place in the style
sheet.
<P> If four length values are specified they apply to top, right,
bottom and left respectively. If there is only one value, it applies
to all sides, if there are two or three, the missing values are taken
from the opposite side.
<div class="example"><P>
<PRE>
BODY { margin: 2em } /* all margins set to 2em */
BODY { margin: 1em 2em } /* top & bottom = 1em, right & left = 2em */
BODY { margin: 1em 2em 3em } /* top=1em, right=2em, bottom=3em, left=2em */
</PRE>
<P> The last rule of the example above is equivalent to the example
below:
<PRE>
BODY {
margin-top: 1em;
margin-right: 2em;
margin-bottom: 3em;
margin-left: 2em; /* copied from opposite side (right) */
}
</PRE>
</div>
<H3><a name="padding-properties">Padding properties</a>:
<span class="propinst-padding-top">'padding-top'</span>,
<span class="propinst-padding-right">'padding-right'</span>,
<span class="propinst-padding-bottom">'padding-bottom'</span>,
<span class="propinst-padding-left">'padding-left'</span>, and
<span class="propinst-padding">'padding'</span>
</H3>
<P> The
padding properties describe how much space to insert between the
border and the content (e.g., text or image). The <span
class="propinst-padding">'padding'</span> property sets the padding
for all four sides while the other padding properties only set their
respective side.
<H4><a name="padding-width-defs">Values for </a><span class="index-def"
title="<padding-width>::definition of"><a
name="value-def-padding-width"><padding-width></a></span></H4>
<P>The properties defined in this section refer to the
<span class="value-inst-padding-width"><padding-width></span>
value type, whose possible values may be:
<P><span class="value-inst-length"><length></span> |
<span class="value-inst-percentage"><percentage></span></P>
<P>Unlike margin properties, values for padding values cannot be
negative.
<P>Like margin properties, percentage values for padding properties
refer to the width of the containing block.
<!-- #include src=properties/padding-top.srb -->
<P> This property sets the top padding of an element.
<div class="example"><P>
<PRE>
BLOCKQUOTE { padding-top: 0.3em }
</PRE>
</div>
<!-- #include src=properties/padding-right.srb -->
<P> This property sets the right padding of an element.
<div class="example"><P>
<PRE>
BLOCKQUOTE { padding-right: 10px }
</PRE>
</div>
<!-- #include src=properties/padding-bottom.srb -->
<P> This property sets the bottom padding of an element.
<div class="example"><P>
<PRE>
BLOCKQUOTE { padding-bottom: 2em }
</PRE>
</div>
<!-- #include src=properties/padding-left.srb -->
<P> This property sets the left padding of an element.
<div class="example"><P>
<PRE>
BLOCKQUOTE { padding-left: 20% }
</PRE>
</div>
<!-- #include src=properties/padding.srb -->
<P> The <span class="propinst-padding">'padding'</span> property is a
shorthand property for setting <span
class="propinst-padding-top">'padding-top'</span>, <span
class="propinst-padding-right">'padding-right'</span>, <span
class="propinst-padding-bottom">'padding-bottom'</span>, and <span
class="propinst-padding-left">'padding-left'</span> at the same place in the style
sheet.
<P> If four values are specified they apply to top, right, bottom and
left respectively. If there is only one value, it applies to all
sides, if there are two or three, the missing values are taken from
the opposite side.
<P> The surface of the padding area is set with the <span
class="propinst-background">'background'</span> property:
<div class="example"><P>
<PRE>
H1 {
background: white;
padding: 1em 2em;
}
</PRE>
<P> The example above sets a '1em' padding vertically (<span
class="propinst-padding-top">'padding-top'</span> and <span
class="propinst-padding-bottom">'padding-bottom'</span>) and a '2em'
padding horizontally (<span
class="propinst-padding-right">'padding-right'</span> and <span
class="propinst-padding-left">'padding-left'</span>). The 'em' unit is
relative to the element's font size: '1em' is equal to the size of the
font in use.
</div>
<H3><a name="border-properties">Border properties</a></H3>
<P>The border properties set the borders of an element. Each element
has four borders, one on each side, that are defined by their width,
color and style.
<H4><a name="border-width-properties">Border width</A>: <span
class="propinst-border-top-width">'border-top-width'</span>, <span
class="propinst-border-right-width">'border-right-width'</span>, <span
class="propinst-border-bottom-width">'border-bottom-width'</span>,
<span class="propinst-border-left-width">'border-left-width'</span>, and
<span class="propinst-border-width">'border-width'</span></H4>
<H5><a name="border-width-defs">Values for </a><span class="index-def"
title="<border-width>::definition of"><a
name="value-def-border-width"
class="value-def"><border-width></a></span></H5>
<P>The properties defined in this section refer to the
<span class="value-inst-border-width"><border-width></span>
value type, whose possible values may be:
<ul>
<li> 'thin' | 'medium' | 'thick' |
<span class="value-inst-length"><length></span></li>
</ul>
<P>The interpretation of the first three values depends on the user agent. The following must hold, however:
<P>'thin' <='medium' <= 'thick'.
<P>Furthermore, these widths must be constant throughout a document.
<P> Border widths cannot be negative.
<!-- #include src=properties/border-top-width.srb -->
<P> This property sets the width of an element's top border.
<div class="example"><P>
<PRE>
H1 { border: solid thick red }
P { border: solid thick blue }
</PRE>
<P> In the example above, H1 and P elements will have the same
border width regardless of font size. To achieve relative widths, the
'em' unit can be used:
<PRE>
H1 { border: solid 0.5em }
</PRE>
</div>
<!-- #include src=properties/border-right-width.srb -->
<P> This property sets the width of an element's right
border.
<!-- #include src=properties/border-bottom-width.srb -->
<P> This property sets the width of an element's bottom border.
<!-- #include src=properties/border-left-width.srb -->
<P> This property sets the width of an element's left border.
<!-- #include src=properties/border-width.srb -->
<P> This property is a shorthand property for setting
<span class="propinst-border-top-width">'border-top-width'</span>,
<span class="propinst-border-right-width">'border-right-width'</span>,
<span class="propinst-border-bottom-width">'border-bottom-width'</span>,
and
<span class="propinst-border-left-width">'border-left-width'</span> at
the same place in the style sheet.
<P> There can be from one to four values, with the following
interpretation:
<UL>
<LI>
one value: all four border widths are set to that value
<LI>
two values: top and bottom border widths are set to the first
value, right and left are set to the second
<LI>
three values: top is set to the first, right and left are set to
the second, bottom is set to the third
<LI>
four values: top, right, bottom and left, respectively
</UL>
<div class="example"><P>
In the examples below, the comments indicate the resulting widths
of the top, right, bottom and left borders:
<PRE>
H1 { border-width: thin } /* thin thin thin thin */
H1 { border-width: thin thick } /* thin thick thin thick */
H1 { border-width: thin thick medium } /* thin thick medium thick */
</PRE>
</div>
<H4><A name="border-color-properties">Border color</A>:
<span class="propinst-border-top-color">'border-top-color'</span>,
<span class="propinst-border-right-color">'border-right-color'</span>,
<span class="propinst-border-bottom-color">'border-bottom-color'</span>,
<span class="propinst-border-left-color">'border-left-color'</span>, and
<span class="propinst-border-color">'border-color'</span>
</H4>
<!-- #include src=properties/border-top-color.srb -->
<!-- #include src=properties/border-right-color.srb -->
<!-- #include src=properties/border-bottom-color.srb -->
<!-- #include src=properties/border-left-color.srb -->
<!-- #include src=properties/border-color.srb -->
<P>The <span class="propinst-border-color">'border-color'</span>
property sets the color of the four borders. <span
class="propinst-border-color">'border-color'</span> can have from one
to four values, and the values are set on the different sides as for
<span class="propinst-border-width">'border-width'</span> above.
<P> If no color value is specified, the value of the <span
class="propinst-color">'color'</span> property of the element itself
will take its place:
<div class="example"><P>
<PRE>
P {
color: black;
background: white;
border: solid;
}
</PRE>
<P> In the above example, the border will be a solid black line.
</div>
<H4><A name="border-style-properties">Border style</a>:
<span class="propinst-border-top-style">'border-top-style'</span>,
<span class="propinst-border-right-style">'border-right-style'</span>,
<span class="propinst-border-bottom-style">'border-bottom-style'</span>,
<span class="propinst-border-left-style">'border-left-style'</span>, and
<span class="propinst-border-style">'border-style'</span></H4>
<H5><a name="border-style-defs">Values for</a> <span class="index-def"
title="<border-style>, definition of"><a
name="value-def-border-style"><border-style></a></span></H5>
<P>The border style properties refer to the <border-style> value
type which is defined as follows:
<UL>
<LI>none | dotted | dashed | solid | double | groove | ridge | inset |
outset
</UL>
<!-- #include src=properties/border-top-style.srb -->
<!-- #include src=properties/border-right-style.srb -->
<!-- #include src=properties/border-bottom-style.srb -->
<!-- #include src=properties/border-left-style.srb -->
<!-- #include src=properties/border-style.srb -->
<P> The <span class="propinst-border-style">'border-style'</span>
property sets the style of the four borders. It can have from one to
four values, and the values are set on the different sides as for
<span class="propinst-border-width">'border-width'</span> above.
<div class="example"><P>
<PRE>
#xy34 { border-style: solid dotted }
</PRE>
<P> In the above example, the horizontal borders will be 'solid' and
the vertical borders will be 'dotted'.
</div>
<P> Since the initial value of the border styles is 'none', no borders
will be visible unless the border style is set.
<P>
The border styles mean:
<DL>
<DT>
none
<DD>
no border is drawn (regardless of the <span
class="propinst-border-width">'border-width'</span> property's value)
<DT><span class="index-def" title="<dotted>, definition of"><a
name="value-def-dotted"><dotted></a></span>
<DD>
the border is a dotted line drawn on top of the background of the element
<DT><span class="index-def" title="<dashed>, definition of"><a name="value-def-dashed"><dashed></a></span>
<DD>
the border is a dashed line drawn on top of the background of the element
<DT>
<span class="index-def" title="<solid>, definition of"><a name="value-def-solid"><solid></a></span>
<DD>
the border is a solid line
<DT>
<span class="index-def" title="<double>, definition of"><a name="value-def-double"><double></a></span>
<DD>
the border is a double line drawn on top of the background of the element.
The sum of the two single lines and the space between equals the
value of <span class="propinst-border-width">'border-width'</span>.
<DT>
<span class="index-def" title="<groove>, definition of"><a name="value-def-groove"><groove></a></span>
<DD>
a 3D groove is drawn in colors based on the value of the <span
class="propinst-color">'color'</span> property.
<DT>
<span class="index-def" title="<ridge>, definition of"><a name="value-def-ridge"><ridge></a></span>
<DD>
a 3D ridge is drawn in colors based on the value of the <span
class="propinst-color">'color'</span> property.
<DT>
<span class="index-def" title="<inset>, definition of"><a name="value-def-inset"><inset></a></span>
<DD>
a 3D inset is drawn in colors based on the value of the <span
class="propinst-color">'color'</span> property.
<DT>
<span class="index-def" title="<outset>, definition of"><a name="value-def-outset"><outset></a></span>
<DD>
a 3D outset is drawn in colors based on the value of the <span
class="propinst-color">'color'</span> property.
</DL>
<P>UAs may interpret all of 'dotted', 'dashed', 'double',
'groove', 'ridge', 'inset' and 'outset' as 'solid'. See the section on <a
href="convent.html#conformance">conformance</a> for details.
<span class="propinst-border-top">'border-top'</span>,
<span class="propinst-border-bottom">'border-bottom'</span>,
<span class="propinst-border-right">'border-right'</span>,
<span class="propinst-border-left">'border-left'</span>, and
<span class="propinst-border">'border'</span>
<!-- #include src=properties/border-top.srb -->
<P> This is a shorthand property for setting the width, style and
color of an element's top border.
<div class="example"><P>
<PRE>
H1 { border-bottom: thick solid red }
</PRE>
<P> The above rule will set the width, style and color of the border
<strong>below</strong> the H1 element. Omitted values will be set to
their initial values:
<PRE>
H1 { border-bottom: thick solid }
</PRE>
<P> Since the color value is omitted in the example above, the border
color will be the same as the 'color' value of the element itself.
</div>
<P> Note that while the <span
class="propinst-border-style">'border-style'</span> property accepts
up to four values, this property only accepts one style value.
<!-- #include src=properties/border-bottom.srb -->
<P> This is a shorthand property for setting the width, style and
color of an element's bottom border. It behaves just like <span
class="propinst-border-top">'border-top'</span>.
<!-- #include src=properties/border-right.srb -->
<P> This is a shorthand property for setting the width, style and
color of an element's right border. It behaves just like <span
class="propinst-border-top">'border-top'</span>.
<!-- #include src=properties/border-left.srb -->
<P> This is a shorthand property for setting the width, style and
color of an element's left border. It behaves just like <span
class="propinst-border-top">'border-top'</span>.
<!-- #include src=properties/border.srb -->
<P> The <span class="propinst-border">'border'</span>
property is a shorthand property for setting the same width, color and
style on all four borders of an element.
<P> Unlike the shorthand <span class="propinst-margin">'margin'</span> and <span class="propinst-padding">'padding'</span> properties, the <span
class="propinst-border">'border'</span> property cannot
set different values on the four borders. To do so, one or more of the
other border properties must be used.
<P> Note that while the <span class="propinst-border-width">'border-width'</span> property accepts up to four
length values, this property only accepts one.
<div class="example"><P>
For example, the first rule below is
equivalent to the set of four rules shown after it:
<PRE>
P { border: solid red }
P {
border-top: solid red;
border-right: solid red;
border-bottom: solid red;
border-left: solid red
}
</PRE>
</div>
<P> Since to some extent the properties have overlapping
functionality, the order in which the rules are specified becomes
important.
<div class="example"><P>
Consider this example:
<PRE>
BLOCKQUOTE {
border-color: red;
border-left: double
color: black;
}
</PRE>
<P> In the above example, the color of the left border will be black,
while the other borders are red. This is due to <span
class="propinst-border-left">'border-left'</span> setting the
width, style and color. Since the color value is not given by the
<span class="propinst-border-left">'border-left'</span> property, it
will be taken from the <span class="propinst-color">'color'</span>
property. The fact that the <span
class="propinst-color">'color'</span> property is set after the <span
class="propinst-border-left">'border-left'</span> property is not
relevant.
</div>
<H2><a name="box-width">Box width calculations</a>: the <span
class="propinst-width">'width'</span> property</H2>
<P>The width of a box generated by an element does not depend on the
width of its children nor on its content -- it is given by the
<span class="propinst-width">'width'</span> property.
<!-- #include src=properties/width.srb -->
<P> This property can be applied to text elements, but it is most
useful with replaced elements such as images.
<P>Negative values for <span class="propinst-width">'width'</span> are
not allowed.
<div class="example"><P>
For example:
<PRE>
IMG.icon { width: 100px }
</PRE>
</div>
<P> If the <span class="propinst-width">'width'</span> and <span
class="propinst-height">'height'</span> of a replaced element are both
'auto', these properties will be set to the intrinsic dimensions of
the element.
<P> See the section on <a href="#scaling">scaling</a> for information about
setting aspect ratios.
<H3>Relationship of width dimensions</H3>
<P><em>See the section on the <a href="flowobj.html#box-model">the box
model</a> for an illustration of box rendering objects.</em>
<P> The width of a block-level element's box is determined by seven
properties: <span class="propinst-margin-left">'margin-left'</span>,
<span class="propinst-border-left">'border-left'</span>, <span
class="propinst-padding-left">'padding-left'</span>, <span
class="propinst-width">'width'</span>, <span
class="propinst-padding-right">'padding-right'</span>, <span
class="propinst-border-right">'border-right'</span>, and <span
class="propinst-margin-right">'margin-right'</span>.
<P>For elements in the flow, the sum of these seven is equal to the
content <span class="propinst-width">'width'</span> of the parent
element.
<P> If 'auto' is set as the value for one of the seven properties in
an element that is inline or floating, it will be treated as if it
were set to zero.
<P>Horizontal margins are not collapsed.
<H3><a name="replaced-width">Width of floats and replaced elements</a></H3>
<P>For floats and replaced elements (i.e., block-level or inline
elements whose markup is replaced by other content such as the IMG
element in HTML), the calculation of width is as follows:
<P> Three of the seven properties given above can be set to 'auto': <span
class="propinst-margin-left">'margin-left'</span>, <span
class="propinst-width">'width'</span>, and <span
class="propinst-margin-right">'margin-right'</span>. For replaced
elements, a value of 'auto' on <span
class="propinst-width">'width'</span> is replaced by the intrinsic
width, so for them there can only be two 'auto' values.
<P> If <EM>exactly one</EM> of <span
class="propinst-margin-left">'margin-left'</span>, <span
class="propinst-width">'width'</span>, or <span
class="propinst-margin-right">'margin-right'</span> is 'auto', the UA
will assign that property a value that will make the sum of the seven
equal to the parent's width.
<P> If <EM>none</EM> of the properties have the value 'auto', the
value of <span class="propinst-margin-right">'margin-right'</span>
will be assigned 'auto'.
<P> If <EM>more than one</EM> of the three is 'auto', and one of them
is <span class="propinst-width">'width'</span>, then the others (<span
class="propinst-margin-left">'margin-left'</span> and/or <span
class="propinst-margin-right">'margin-right'</span>) will be set to
zero and <span class="propinst-width">'width'</span> will get the
value needed to make the sum of the seven equal to the parent's width.
<P> Otherwise, if both <span
class="propinst-margin-left">'margin-left'</span> and <span
class="propinst-margin-right">'margin-right'</span> are 'auto', they
will be set to equal values. This will center the element inside its
parent.
<H3>Width of absolutely positioned elements</H3>
<P>The width of an absolutely positioned element's box is specified
with the <span class="propinst-width">'width'</span> property.
<P>However, if the <span class="propinst-width">'width'</span> has the
value 'auto', the width of the box is given by the <span
class="propinst-left">'left'</span> and <span
class="propinst-right">'right'</span> properties. Note that these take
the place of the <span
class="propinst-margin-left">'margin-left'</span> and <span
class="propinst-margin-right">'margin-right'</span> properties, which
don't apply to absolutely positioned elements.
<P>If all three properties have the value 'auto', the box has
exactly the width of the inherited reference box.
<H3><a name="min-max-widths">Minimum and maximum widths</a>: <span
class="propinst-min-width">'min-width'</span> and <span
class="propinst-max-width">'max-width'</span></h3>
<P>It is sometimes useful to constrain the width of elements to a
certain range. Two properties offer this functionality:
<!-- #include src=properties/min-width.srb -->
<!-- #include src=properties/max-width.srb -->
<P>This algorithm describes how the two properties influence the width
calculations:
<OL>
<LI>the normal width calculations (without 'min-width' and 'max-width')
are performed and the calculated width is found
<LI>if the value of 'min-width' is greater than the value of
'max-width', 'max-width' should be set to the value of 'min-width'
<LI>if the calculated width is greater than 'max-width', the
value of 'width' is set to 'max-width'. Goto step 1.
<LI>if the calculated width is smaller than 'min-width', the
value of 'width' is set to 'min-width'. Goto step 1.
<LI>terminate
</OL>
<P>When the algorithm terminates, use the calculated width as the
width of the element.
<!--
The <span class="propinst-width">'width'</span> has a
non-negative UA-defined minimum value (which may vary from element to
element and even depend on other properties).
<P>A style sheet may add an additional constraint on the Users may override the UA-defined value with the following
property.
<P>If <span class="propinst-width">'width'</span> goes below the minimum
width, either because it was set explicitly, or because it was 'auto'
and the box width calculations would make it too small, the value will
be replaced with the minimum value instead.
<P>Similarly, if an element's <span
class="propinst-width">'width'</span> goes beyond the width of its
parent or reference box, either because it was set explicitly,
or because it was 'auto' and the box width calculations would make it
too large, the value will be replaced by either the width of the
parent or reference box, or the value set by <span
class="propinst-max-width">'max-width'</span>, whichever is smaller.
-->
<H2><a name="box-height">Box height calculations</a>: the <span
class="propinst-height">'height'</span> property</H2>
<P>The height of a box is the minimal height necessary to include the
vertical content of the element and that of all its flowed children
(see also the section on <a href="#min-max-heights">minimum and
maximum heights</a>). This is the height necessary <em>before</em> any
relative offset of children.
<P>However, the height of an element may be set explicitly with
the <span class="propinst-height">'height'</span> property.
<!-- #include src=properties/height.srb -->
<P> This property can be applied to text, but it is most useful with
replaced elements such as images.
<div class="example"><P>
<PRE>
IMG.icon { height: 100px }
</PRE>
</div>
<P> If the <span class="propinst-width">'width'</span> and <span
class="propinst-height">'height'</span> of a replaced element are both
'auto', these properties will be set to the intrinsic dimensions of
the element.
<P> If applied to a textual element, the height can be enforced by the
user interface (e.g., a scrollbar).
<P> Negative values for <span class="propinst-height">'height'</span>
are not allowed.
<P> See the section on <a href="#scaling">scaling</a> for information about
setting aspect ratios.
<!-- Ian: Is this true??? -->
<P>User agents may ignore the
<span class="propinst-height">'height'</span> property (i.e., treat it
as 'auto') if the element is not a replaced element.
<H3>Height of replaced elements</H3>
<P>The height of a replaced element is calculated in a way analogous
to the calculation of the <a href="#replaced-width">width of a
replaced element</a>.
<H3>Height of absolutely positioned elements</H3>
<P>The height of an absolutely positioned element's box is specified
with the <span class="propinst-height">'height'</span> property. A
percentage value for the <span class="propinst-height">'height'</span>
property is computed with respect to the height of the parent
element. However, specifying a percentage value for <span
class="propinst-height">'height'</span> when the parent element's height
is set to 'auto' results in undefined behavior.
<P>If the <span class="propinst-height">'height'</span> has the
value 'auto', the height of the box is given by the <span
class="propinst-top">'top'</span> and <span
class="propinst-bottom">'bottom'</span> properties. Note that these take
the place of the <span
class="propinst-margin-top">'margin-top'</span> and <span
class="propinst-margin-bottom">'margin-bottom'</span> properties, which
don't apply to absolutely positioned elements.
<P>If all three properties have the value 'auto', the box has
exactly the height of the inherited reference box.
<H3><a name="min-max-heights">Minimum and maximum heights</a>: <span
class="propinst-min-height">'min-height'</span> and <span
class="propinst-max-height">'max-height'</span></h3>
<P>It is sometimes useful to constrain the height of elements to a
certain range. Two properties offer this functionality:
<!-- #include src=properties/min-height.srb -->
<!-- #include src=properties/max-height.srb -->
<P>This algorithm describes how the two properties influence the height
calculations:
<OL>
<LI>the normal height calculations (without 'min-height' and 'max-height')
are performed and the calculated height is found
<LI>if the value of 'min-height' is greater than the value of
'max-height', 'max-height' should be set to the value of 'min-height'
<LI>if the calculated height is greater than 'max-height', the
value of 'height' is set to 'max-height'. Goto step 1.
<LI>if the calculated height is smaller than 'min-height', the
value of 'height' is set to 'min-height'. Goto step 1.
<LI>terminate
</OL>
<P>When the algorithm terminates, use the calculated height as the
height of the element.
<!--
<P>If <span class="propinst-height">'height'</span> goes below the minimum
height, either because it was set explicitly, or because it was 'auto'
and the box height calculations would make it too small, the value will
be replaced with the minimum value instead.
<P>Similarly, if an element's <span
class="propinst-height">'height'</span> goes beyond the height of its
parent or reference box, either because it was set explicitly,
or because it was 'auto' and the box height calculations would make it
too large, the value will be replaced by either the height of the
parent or reference box, or the value set by <span
class="propinst-max-height">'max-height'</span>, whichever is smaller.
-->
<H3><a name="collapsing-margins">Collapsing margins</a></H3>
<P> Two or more adjoining vertical margins (i.e., with no border,
padding or content between them) are collapsed to use the maximum of
the margin values. In most cases, after collapsing the vertical
margins the result is visually more pleasing and closer to what the
designer expects. Please consult the <a
href="./flowobj.html#mpb-examples">examples of margin, padding, and
borders</a> for an illustration of collapsed margins.
<P> In the case of negative margins, the absolute maximum of the
negative adjoining margins is deducted from the maximum of the
positive adjoining margins. If there are no positive margins, the
absolute maximum of the negative adjoining margins is deducted from
zero.
<H3><a name="containing-block">Containing blocks</a></H3>
<P>In CSS2, all box positions are calculated with respect to the inner
edges of a rectangular box called a <span class="index-def"
title="containing block"><dfn>containing block</dfn></span>. The
default containing block is the box generated for the root element of
the <a href="convent.html#doctree">document tree</a>.
<P>The containing block is defined as follows:
<ul>
<li> If a box has no parent, then it has no containing block
<li> Otherwise, if the value of the <span
class="propinst-position">'position'</span> property for the parent
element is anything besides 'static' then the containing block is that
parent
<li> Otherwise, if the value of the <span
class="propinst-display">'display'</span> property for the parent
element is anything else besides 'inline' then the containing block is
that parent
<li> Otherwise, the containing block is the containing block
of the parent.
</ul>
<P>When the containing block is established by a <a
href="flowobj.html#block-level">block-level</a> box, it has the same
width, height, and position as the content and padding area of the
block-level box. When the containing block is established by an <a
href="flowobj.html#inline">inline</a> box, it has the same width,
height, and position as the content and padding area of the first <a
href="#line-box">line box</a> generated by the inline box.
<P>For example, for an inline element like EM, the containing block is
typically the enclosing paragraph (P). On the other hand, the
containing block of a positioned element is the element relative to
which it is positioned.
<P>Inline elements with 'position: relative' form a special group of
containing blocks; they are not block-level elements and -- if they
span several lines -- they are not rectangular. The "starting" point
for relative offsets in a containing block established by inline
elements is the top left corner of the first line box for
left-to-right scripts and the top right corner for right-to-left
scripts.
<!-- The secondary direction in CSS2 is top-to-bottom. -->
[HWL: add figure]
<H2><a name="scaling">Scaling</a></h2>
<P>If necessary, user agents may enforce an element's width and height
by scaling it. When scaling, the aspect ratio of the image is
preserved if values for the <span
class="propinst-width">'width'</span> and <span
class="propinst-height">'height'</span> properties are set to 'auto'.
<P>Authors may also specify a different aspect ratio that should be
preserved in scaling with the following property.
<H2><a name="line-height">Line height calculations</a>: the <span
class="propinst-line-height">'line-height'</span> and <span
class="propinst-vertical-align">'vertical-align'</span>
properties</H2>
<P>As described in the section on <a
href="flowobj.html#horizontal-formatting">horizontal formatting
contexts</a>, user agents flow inline boxes horizontally into a series
of <a name="line-box">line boxes</a>. Each line box is a rectangle whose width is defined by
the first enclosing block element (see the section on <a
href="flowobj2.html#box-width">box width calculations</a>)
<P>The line box height is determined as follows. All elements have the
<span class="propinst-line-height">'line-height'</span> property,
which has the following meaning:
<ul>
<li>If the property is set on a block-level element, it
specifies the <em>minimal</em> line height for all lines of text
generated by the element.
<li>If the property is set on an inline element, it
specifies the <em>exact</em> line height for the element's inline box.
</ul>
<p>Since several inline elements may generate inline boxes on the same
line, the final height of a given line box is the maximum of the
minimal line height specified for the parent block-level element and
the heights required by all inline boxes on the current line. Replaced
elements that create inline boxes (e.g., inline images) also affect
the line height, but via the <span
class="propinst-height">'height'</span> and <span
class="propinst-vertical-align">'vertical-align'</span> properties,
not the <span class="propinst-line-height">'line-height'</span>
property. Replaced elements increase the line box height if the top of
the replaced element (i.e., including all of its padding, border and
margin) is above the tallest text section, or if the bottom is below
the lowest.
<P>When text on a line is smaller than the line box height, space may
be added above and below the text. For example, if the text is 12pt
high and the current line height is '14pt', 2pts of extra space is
added, namely 1pt above and 1pt below the line. Empty elements
influence these calculations just like elements with content.
<P>The difference between the font size and the line height is called
the <span class="index-def"
title="leading"><EM>leading</EM></span>. Half the leading is called
the <span class="index-def"
title="half-leading"><EM>half-leading</EM></span>. If a line of text
contains inline elements with different <span
class="propinst-line-height">'line-height'</span> values, then each
inline element has its own half-leading above and below.
<P>Note that the top and bottom of a line box do not necessarily
correspond to the tallest element, since elements can be positioned
vertically with the <span
class="propinst-vertical-align">'vertical-align'</span> property.
<!-- Give an example/drawing-->