-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathvisudet.src
More file actions
844 lines (713 loc) · 34.4 KB
/
visudet.src
File metadata and controls
844 lines (713 loc) · 34.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<!-- $Id: visudet.src,v 2.25 1998-04-04 00:30:19 ijacobs Exp $ -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Visual rendering model details</TITLE>
</HEAD>
<BODY>
<H1 align="center">Visual rendering model details</H1>
<H2><a name="containing-block-details">Details of containing block
calculation</a></H2>
<P>The containing block for a box other than the root box is determined
as follows:</p>
<ul>
<li>If the value of the <span
class="propinst-position">'position'</span> property for the parent
element is anything but 'static' then the containing block is established
by the parent box.
<li>Otherwise, if the value of the <span
class="propinst-display">'display'</span> property for the parent
element is anything but 'inline' then the containing block is
established by the parent box.
<!-- What about display: none above? -IJ -->
<li>Otherwise, the containing block is the parent's containing block.
</ul>
<P>When a containing block is established by a <a
href="visuren.html#block-box">block</a> box, it has the same
width, height, and position as the box's <a
href="box.html#padding-edge">padding edge</a>. The edges
are called the top, bottom, left, and right of the containing block.
<P>When a containing block is established by an <a
href="visuren.html#inline-level">inline-level</a> element, it has the
same width, height, and position as the <a
href="box.html#padding-edge">padding edge</a> of the first (in the
source tree) inline box generated by the inline-level element.
<!-- The previous paragraph does not comply with the WG's decision
in. Note, especially, in WG solution, that percentages applied to
negative widths cause problems. -IJ -->
<P><a href="visuren.html#relative-positioning">Relatively
positioned</a> <a href="visuren.html#inline-box">inline</a> boxes must be
considered specially since (1) the <a
href="conform.html#rendered-content">rendered content</a> of an inline-level
element may not be rectangular in shape but (2) a relatively
positioned box establishes a new containing block and containing
blocks must be rectangular. The reference edges for descendants
are the following:</p>
<ul>
<li>For left-to-right scripts, the left and top edges are those
of the first inline box. The bottom and right edges are those
of the last inline box.
<li>For right-to-left scripts, the right and top edges are those
of the first inline box. The bottom and left edges are those
of the last inline box.
</ul>
<H2>Calculation of box and line box widths</h2>
<P>Box and line box widths and heights may be established in one of
several ways:</p>
<dl>
<dt><em>Width and height properties set explicitly</em>
<dd>If <span class="propinst-width">'width'</span> or <span
class="propinst-height">'height'</span> is set explicitly (i.e., not
'auto'), the box will have the specified width or height, except in
tables, where a 'width' or 'height' is interpreted as a
<em>minimum</em> size, or even ignored, depending on the <a
href="tables.html#layout-algos">table layout algorithm</a>.
The <span class="propinst-width">'width'</span>
and <span class="propinst-height">'height'</span> properties
do not apply to non-replaced inline elements.
<dt><em>Block box widths are calculated top-down</em>
<dd>The
<a href="#box-width">width of a block box</a>
is given by the width of its
containing block minus the box's margins, borders, and padding.
<dt><em>Inline box widths are calculated bottom-up</em>
<dd>The <a
href="#box-width">width of an inline box</a>
is given by its
<a href="conform.html#rendered-content">rendered content</a>.
<dt><em>Block box heights are calculated bottom-up</em>
<dd>Block level boxes grow to the size of the boxes
they contain (unless the <span class="propinst-height">'height'</span>
property is set).
Please consult the section on <a
href="#box-height">box height calculations</a> for
details.
<dt><em>Inline box heights are given by the <span
class="propinst-line-height">'line-height'</span> property</em>
<dd>Please consult the section on <a
href="#box-height">box height calculations</a> for
details.
<dt><em>Line heights depend on inline box heights and alignment</em>
<dd>Please consult the section on <a
href="#line-height">line height calculations</a> for
details.
<dt><em><a name="intrinsic-dim">Intrinsic dimension of replaced
content</a></em>
<dd>The <a href="conform.html">rendered content</a> of a <a
href="conform.html#replaced-element">replaced element</a> may have
"intrinsic dimensions" that user agents use as the <a
href="cascade.html#computed-value">computed</a> content
width and height (e.g., the unscaled width and height of an included
image). If the intrinsic dimensions are overridden, the
replaced content is scaled by the user agent.
When scaling an element with intrinsic dimensions,
the aspect ratio is preserved
if values for the <span class="propinst-width">'width'</span> and
<span class="propinst-height">'height'</span> properties are set to
'auto'.
<dt><em>Hybrid calculations</em>
<dd>The dimension of a table cell is determined by both the cell's
contents and the surrounding available space.
</dl>
<P>The sections below describe these calculations in detail.
<H2><a name="box-width">Box width calculations</a></H2>
<P>As discussed in the section on <a
href="box.html#box-dimensions">box dimensions</a>, the <a
href="box.html#content-width">content width</a> of a box is assigned
explicitly (via the <span class="propinst-width">'width'</span>
property), given "intrinsically" (for replaced elements), or
calculated "top-down" (based on the width of the box's containing
block).
<P>The following sections explain the exact computation of a box's
width-related properties.
<h3><a name="the-width-property">Content width</a>: the <span
class="propinst-width">'width'</span> property</H3>
<!-- #include src=properties/width.srb -->
<P> This property specifies the <a
href="box.html#content-width">content width</a> of a block box. Values
have the following meanings:</P>
<dl>
<dt><span class="index-inst" title="<length>"><span class="value-inst-length"><strong><length></strong></span></span>
<dd>Specifies a fixed width.
<dt><span class="index-inst" title="<percentage>"><span class="value-inst-percentage"><strong><percentage></strong></span></span>
<dd>Specifies a percentage width. The percentage is calculated
with respect to width
of the generated box's
<a href="visuren.html#containing-block">containing block</a>.
<dt><strong>auto</strong>
<dd>See the section on <a href="#normal-floated">widths
of boxes in the normal flow
and floated boxes</a>.
</dl>
<P>Negative values for <span class="propinst-width">'width'</span> are
illegal. User agents must <a href="syndata.html#ignore">ignore</a> this
property for elements with <span
class="propinst-display">'display'</span> set to 'row' or 'row-span'.
<div class="example"><P>
For example, the following rule fixes the width of paragraphs
to 100 pixels:</p>
<PRE>
P { width: 100px }
</PRE>
</div>
<h3><a name="normal-floated">Width of boxes in the normal flow and
floated boxes</a></h3>
<P>The <span class="propinst-width">'width'</span> property does not
apply to non-replaced <a
href="visuren.html#inline-level">inline-level</a> elements. These
elements generate boxes that 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>For other types of boxes in the <a
href="visuren.html#normal-flow">normal flow</a> and for <a
href="visuren.html#floats">floats</a>, a box's margin, padding,
border, and content width must equal the width of its <a
href="visuren.html#containing-block">containing block</a>. These widths are
specified with the following 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>.
However, if the <span class="propinst-border-style">'border-style'</span>
for an element has the value 'none', the corresponding border widths
will be '0'.
<P>Three of these properties (<span
class="propinst-margin-left">'margin-left'</span>, <span
class="propinst-width">'width'</span>, and <span
class="propinst-margin-right">'margin-right'</span>) may take the
value 'auto'. Their <a href="cascade.html#computed-value">computed
values</a> are determined as follows.
<h4>Determining the content width</h4>
<P>When the <span class="propinst-width">'width'</span>
property has the value 'auto', user agents should
assign it a <a href="cascade.html#computed-value">computed value</a>
based on <a href="#comp-margin-widths">computed margin widths</a>.
In addition:</p>
<ol>
<li>For <a href="visuren.html#inline-level">inline-level</a> elements
and those that generate <a href="visuren.html#floats">floating</a>
boxes, the computed value of <span
class="propinst-width">'width'</span> is '0'.
<li>For <a href="conform.html#replaced-element">replaced elements</a>,
user agents should use the <a
href="#intrinsic-dim">intrinsic width</a> of the element's
<a href="conform.html#rendered-content">rendered content</a> as the
box's <a href="cascade.html#computed-value">computed</a> width. (Note
that for other values of <span class="propinst-width">'width'</span>,
the replaced contents may be scaled).
<li><a href="#min-max-widths">Minimum and maximum</a> computed values
for the <span class="propinst-width">'width'</span> property may be
assigned with the <span class="propinst-min-width">'min-width'</span>
and <span class="propinst-max-width">'max-width'</span> properties.
</ol>
<h4><a name="comp-margin-widths">Computing margin widths</a></h4>
<P>User agents should assign <a
href="cascade.html#computed-value">computed values</a> for <span
class="propinst-margin-left">'margin-left'</span>, <span
class="propinst-width">'width'</span>, and <span
class="propinst-margin-right">'margin-right'</span> as follows:</p>
<ol>
<li>If exactly one of <span
class="propinst-margin-left">'margin-left'</span>, <span
class="propinst-width">'width
FE6D
039;</span> or <span
class="propinst-margin-right">'margin-right'</span> has the value
'auto', the computed value of that property is assigned
so that the seven width properties add up to the
width of the <a href="visuren.html#containing-block">containing block</a>.
<li>If none of the properties has the value 'auto', <span
class="propinst-margin-right">'margin-right'</span> is assigned a
computed value so that the seven width properties add up to the
width of the <a href="visuren.html#containing-block">containing block</a>.
<li>If more than one of the three has the value 'auto', and one of
them is <span class="propinst-width">'width'</span>, than the other
two (<span class="propinst-margin-left">'margin-left'</span> and/or
<span class="propinst-margin-right">'margin-right'</span>) will be
assigned the computed value '0' and <span
class="propinst-width">'width'</span> will be assigned a computed
value so that the seven width properties add up to the width of the <a
href="visuren.html#containing-block">containing block</a>.
<li>Otherwise, if both <span
class="propinst-margin-left">'margin-left'</span> and <span
class="propinst-margin-right">'margin-right'</span> have the value
'auto', they will each be assigned a computed value that is half of
the available horizontal space (this centers the box within its
containing block).
</ol>
<H3><a name="abs-width">Width of absolutely positioned boxes</a></H3>
<P>The width of an <a
href="visuren.html#absolute-positioning">absolutely positioned</a> box
may be computed in three ways:
<ol>
<li>The element generating the box has a
value other than 'auto' for the <span
class="propinst-width">'width'</span> property.
<li>The element is a replaced element with an intrinsic width
and <span class="propinst-width">'width'</span> has the value 'auto'.
<li>The width is given by the difference between the
<span class="propinst-left">'left'</span> and
<span class="propinst-right">'right'</span> offsets
(minus padding, borders, and margins). When
padding, border, and margin properties have the specified
value 'auto', the computed value is '0'.
</ol>
<P>In cases one and two, for left-to-right formatting, values of <span
class="propinst-left">'left'</span> and <span
class="propinst-right">'right'</span> are computed as follows:</p>
<ul>
<li>If both <span class="propinst-left">'left'</span> and
<span class="propinst-right">'right'</span> have the value
'auto', <span class="propinst-left">'left'</span> is the
offset between the left containing block edge and
the box's left side as though it were in normal flow. Then <span
class="propinst-right">'right'</span> is computed based
on the known left offset and width.
<li>If one property has a value other than 'auto',
this known offset and the width are used to calculate
the offset of the opposite side.
<li>If both properties have a value other than 'auto', <span
class="propinst-right">'right'</span> is treated as though it
were 'auto'.
</ul>
<P>In case three, for left-to-right formatting, values of <span
class="propinst-left">'left'</span>, <span
class="propinst-right">'right'</span>, and <span
class="propinst-width">'width'</span> are computed as follows:</P>
<ul>
<li>If <span class="propinst-right">'right'</span> has
the value 'auto', it is assigned the value '0'.
The width is the (absolute) distance
between the right containing
block edge and the box's left edge. A
value of 'auto' for <span class="propinst-left">'left'</span>
means the left offset is calculated as though the box
were in normal flow.
<li>For other values of <span class="propinst-right">'right'</span>,
the width is the (absolute) distance
between the right offset
and the position of the box's left edge, calculated as before.
</ul>
<P>For all of the above cases, analogous rules hold for right-to-left
formatting, switching right and left.
<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>
<!-- #include src=properties/min-width.srb -->
<!-- #include src=properties/max-width.srb -->
<P>These two properties allow authors to constrain box widths to a
certain range. Values have the following meanings:</p>
<dl>
<dt><span class="index-inst" title="<length>"><span class="value-inst-length"><strong><length></strong></span></span>
<dd>Specifies a fixed minimum or maximum computed width.
<dt><span class="index-inst" title="<percentage>"><span class="value-inst-percentage"><strong><percentage></strong></span></span>
<dd>Specifies a percentage for determining the computed value.
The percentage is calculated
with respect
to the width of the
generated box's
<a href="visuren.html#containing-block">containing block</a>.
</dl>
<P>The following algorithm describes how the two properties influence
the <a href="cascade.html#computed-value">computed value</a>
of the <span class="propinst-width">'width'</span> property:</p>
<OL>
<LI>the <a href="#normal-floated">normal width</a> is computed
(without <span class="propinst-min-width">'min-width'</span> and <span
class="propinst-max-width">'max-width'</span>).
<LI>if the computed value of <span
class="propinst-min-width">'min-width'</span> is greater than the
value of <span class="propinst-max-width">'max-width'</span>, <span
class="propinst-max-width">'max-width'</span> is set to the
value of <span class="propinst-min-width">'min-width'</span>.
<LI>if the computed width is greater than <span
class="propinst-max-width">'max-width'</span>, the computed value of
<span class="propinst-width">'width'</span> is set to the value of
<span class="propinst-max-width">'max-width'</span>.
<LI>if the computed width is smaller than <span
class="propinst-min-width">'min-width'</span>, the computed value of
<span class="propinst-width">'width'</span> is set to the value of
<span class="propinst-min-width">'min-width'</span>.
</OL>
<P>The user agent may define a non-negative minimum value for the
<span class="propinst-width">'width'</span> property, which may vary
from element to element and even depend on other properties. If <span
class="propinst-width">'width'</span> goes below this limit, either
because it was set explicitly, or because it was 'auto' and the rules
below would make it too small, the user agent may use the minimum
value as the computed value.
<H2><a name="box-height">Box height calculations</a></H2>
<P>As discussed in the section on <a
href="box.html#box-dimensions">box dimensions</a>, the <a
href="box.html#content-height">content height</a> of a box is assigned
explicitly (via the <span class="propinst-height">'height'</span>
property), given "intrinsically" (for replaced elements), or
calculated as the minimal height necessary to include the vertical
content of the element and that of all its flowed children. This is
the height necessary <em>before</em> any relative offset of children.
<P>The following sections explain the exact computation of a
box's height-related properties.
<h3><a name="the-height-property">Content height</a>: the <span
class="propinst-height">'height'</span> property</H3>
<!-- #include src=properties/height.srb -->
<P> This property specifies a box's <a
href="box.html#content-height">content height</a>. Values have the
following meanings:</P>
<dl>
<dt><span class="index-inst" title="<length>"><span class="value-inst-length"><strong><length></strong></span></span>
<dd>Specifies a fixed height.
<dt><span class="index-inst" title="<percentage>"><span class="value-inst-percentage"><strong><percentage></strong></span></span>
<dd>Specifies a percentage height. The percentage is calculated
with respect to the <em>width</em> of the
generated box's <a href="visuren.html#containing-block">containing block</a>.
<dt><strong>auto</strong>
<dd>See the section on <a href="#normal-floated">heights
of boxes in the normal flow
and floated boxes</a>.
</dl>
<P>Negative values for <span class="propinst-height">'height'</span>
are illegal. User agents must <a href="syndata.html#ignore">ignore</a>
this property for elements with <span
class="propinst-display">'display'</span> set to 'col' or 'column-span'.
<div class="example"><P>
For example, the following rule fixes the height of paragraphs
to 100 pixels:</p>
<PRE>
P { height: 100px }
</PRE>
<P>Paragraphs that require more than 100 pixels of height will
<a href="visufx.html#overflow">overflow</a> according
to the <span class="propinst-overflow">'overflow'</span> property.
</div>
<P>The height may be enforced by the user interface (e.g., a
scrollbar).
<H3><a name="normal-height">Determining the content height</a></H3>
<P>When the <span class="propinst-height">'height'</span> property has
the value 'auto', user agents should assign it a <a
href="cascade.html#computed-value">computed value</a> based on the
space required by the element's <a
href="conform.html#rendered-content">rendered content</a>. In
addition:</p>
<ol>
<li>For <a href="conform.html#replaced-element">replaced elements</a>,
user agents should use the <a
href="#intrinsic-dim">intrinsic height</a> of the element's
<a href="conform.html#rendered-content">rendered content</a> as the
box's <a href="cascade.html#computed-value">computed</a> height. (Note
that for other values of <span class="propinst-height">'height'</span>,
the replaced contents may be scaled).
<li><a href="#min-max-widths">Minimum and maximum</a> computed values
for the <span class="propinst-height">'height'</span> property may be
assigned with the <span class="propinst-min-height">'min-height'</span>
and <span class="propinst-max-height">'max-height'</span> properties.
</ol>
<H3>Height of absolutely positioned boxes</H3>
<P>The height of an <a
href="visuren.html#absolute-positioning">absolutely positioned</a> box
may be computed in three ways:
<ol>
<li>The element generating the box has a
value other than 'auto' for the <span
class="propinst-height">'height'</span> property.
<li>The element is a replaced element with an intrinsic height
and <span class="propinst-height">'height'</span> has the value 'auto'.
<li>The height is given by the different between the
<span class="propinst-top">'top'</span> and
<span class="propinst-bottom">'bottom'</span> offsets
(minus padding, borders, and margins). When
padding, border, and margin properties have the specified
value 'auto', the computed value is '0'.
In this case, the height of the box's containing
block must be known, otherwise the <span
class="propinst-bottom">'bottom'</span> of the
box cannot be specified and the height is undefined.
</ol>
<P>In cases one and two, values of <span
class="propinst-top">'top'</span> and <span
class="propinst-bottom">'bottom'</span> are computed as follows:</p>
<ul>
<li>If both <span class="propinst-top">'top'</span> and
<span class="propinst-bottom">'bottom'</span> have the value
'auto', <span class="propinst-top">'top'</span> is the
offset between the top containing block edge and
the box's top side as though it were in normal flow. Then <span
class="propinst-bottom">'bottom'</span> is computed based
on the known top offset and height.
<li>If one property has a value other than 'auto',
this known offset and the height are used to calculate
the offset of the opposite side.
<li>If both properties have a value other than 'auto', <span
class="propinst-bottom">'bottom'</span> is treated as though it
were 'auto'.
</ul>
<P>In case three, the values of <span
class="propinst-top">'top'</span>, <span
class="propinst-bottom">'bottom'</span>, and <span
class="propinst-height">'height'</span> are computed as follows:</P>
<ul>
<li>If <span class="propinst-bottom">'bottom'</span> has
the value 'auto', it is assigned the value '0'.
The height is the (absolute) distance
between the bottom containing
block edge and the box's top edge. A
value of 'auto' for <span class="propinst-top">'top'</span>
means the top offset is calculated as though the box
were in normal flow.
<li>For other values of <span class="propinst-bottom">'bottom'</span>,
the width is the (absolute) distance
between the bottom offset
and the position of the box's top edge, calculated as before.
</ul>
<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>These two properties allow authors to constrain box heights to a
certain range. Values have the following meanings:</p>
<dl>
<dt><span class="index-inst" title="<length>"><span class="value-inst-length"><strong><length></strong></span></span>
<dd>Specifies a fixed minimum or maximum computed height.
<dt><span class="index-inst" title="<percentage>"><span class="value-inst-percentage"><strong><percentage></strong></span></span>
<dd>Specifies a percentage for determining the computed value.
The percentage is calculated
with respect
to the generated box's <a href="visuren.html#containing-block">containing block</a>.
</dl>
<P>The following algorithm describes how the two properties influence
the <a href="cascade.html#computed-value">computed value</a>
of the <span class="propinst-height">'height'</span> property:</p>
<OL>
<LI>the <a href="#normal-height">normal height</a> is computed
(without <span class="propinst-min-height">'min-height'</span> and
<span class="propinst-max-height">'max-height'</span>).
<LI>if the value of <span
class="propinst-min-height">'min-height'</span> is greater than the
value of <span class="propinst-max-height">'max-height'</span>, <span
class="propinst-max-height">'max-height'</span> is set to the
value of <span class="propinst-min-height">'min-height'</span>
<LI>if the calculated height is greater than <span
class="propinst-max-height">'max-height'</span>, the value of <span
class="propinst-height">'height'</span> is set to <span
class="propinst-max-height">'max-height'</span>.
<LI>if the calculated height is smaller than <span
class="propinst-min-height">'min-height'</span>, the value of <span
class="propinst-height">'height'</span> is set to <span
class="propinst-min-height">'min-height'</span>.
</OL>
<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="visuren.html#inline-formatting">inline formatting contexts</a>,
user agents flow inline boxes into a vertical stack of <a
href="visuren.html#line-box">line boxes</a>. The height of a line box
is determined as follows:</p>
<ol>
<li>The height of each inline box in the line box is calculated. The
height of an inline box is given by its <span
class="propinst-line-height">'line-height'</span> property, unless it
is generated by
a <a href="conform.html#replaced-element">replaced element</a>, in
which case the <span class="propinst-height">'height'</span> property
gives the height of the inline box.
<li>The inline boxes are aligned vertically according
to their <span class="propinst-vertical-align">'vertical-align'</span>
property. If an element
has the values 'top' or 'bottom' for this property, only
the height of the generated boxes affects the line box
height calculation; the boxes cannot be aligned until the
line box has been fully constructed.
<li>The line box height is the distance between the uppermost
box top and the lowermost box bottom.
</ol>
<p>Empty inline elements generate empty inline boxes, but these boxes
still have margins, padding, borders and a line height, and thus
influence these calculations just like elements with content.
<P>Note that if all the boxes in the line box are aligned along their
bottoms, the line box will be exactly the height of the tallest box.
If, however, the boxes are aligned along a common baseline, the line
box top and bottom may not touch the top and bottom of the tallest
box.
<P>Note that top and bottom margins, borders, and padding specified
for <a href="visuren.html#inline-level">inline-level</a> elements do
<em>not</em> enter into the calculation of line box heights
but are visible (inside and outside line
boxes).
<H3>Leading and half-leading</h3>
<P>Since the height of an inline box may be different from the font size
of text in the box (e.g., <span
class="propinst-line-height">'line-height'</span> > 1em), there may
be space above and below rendered glyphs. The difference between the
font size and the (actual) value of <span
class="propinst-line-height">'line-height'</span> 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>.
<P>User agents center the glyph vertically in the box, adding
half-leading on the top and bottom. For example, if a piece of text
is '12pt' high and the <span
class="propinst-line-height">'line-height'</span> value is '14pt',
2pts of extra space should be added: 1pt above and 1pt below the
letters. (This applies to empty boxes as well, as if the empty box
contained an infinitely narrow letter.)
<P>When the <span class="propinst-line-height">'line-height'</span>
value is less than the font size, the final line box height will be
less than the font size and the rendered glyphs will "bleed" outside
the box. If such a box touches the edge of a line box, the rendered
glyphs will also "bleed" into the adjacent line box.
<P>Although margins, borders, and padding do not enter into the line
box height calculation, they are still rendered around inline boxes
(except where boxes are split across lines). This means that if the
height of a line box is shorter than the <a
href="box.html#outer-edge">outer edges</a> of the boxes it
contains, backgrounds and colors may "bleed" into adjacent line
boxes. However, in this case, some user agents may use the line box to
"clip" the border and padding areas (i.e., not render them).
<!-- #include src=properties/line-height.srb -->
<p>If the property is set on a <a
href="visuren.html#block-level">block-level</a> element whose content
is composed of <a href="visuren.html#inline-level">inline-level</a>
elements, it specifies the <em>minimal</em> height of each inline box.
<p>If the property is set on an <a
href="visuren.html#inline-level">inline-level</a> element, it
specifies the <em>exact</em> height of each box generated by the
element. (Except for inline <a
href="conform.html#replaced-element">replaced elements</a>, where the
height of the box is given by the <span
class="propinst-height">'height'</span> property.)
<P>Values for this property have the following meanings:</p>
<dl>
<dt><strong>normal</strong>
<dd>Tells user agents to set the <a
href="cascade.html#computed-value">
computed value</a> to a "reasonable"
value based on the font size of the element. The
value has the same meaning as <span class="index-inst" title="<number>"><span class="value-inst-number"><number></span></span>
We recommend a number between 1.0 to 1.2.
<dt><span class="index-inst" title="<length>"><span
class="value-inst-length"><strong><length></strong></span></span>
<dd>The box height is set to this length. Negative values are illegal.
<dt><span class="index-inst" title="<number>"><span
class="value-inst-number"><strong><number></strong></span></span>
<dd>The
<a href="cascade.html#computed-value">
computed value</a> of the property is this number multiplied by the
element's font size. Negative values are illegal. However, the
number, not the <a href="cascade.html#actual-value">actual value</a>,
is inherited.
<dt><span class="index-inst" title="<percentage>"><span
class="value-inst-percentage"><strong><percentage></strong></span></span>
<dd>The <a href="cascade.html#actual-value"> actual value</a> of the
property is this percentage multiplied by the element's font size.
Negative values are illegal.
</dl>
<P>Note that replaced elements have a <span
class="propinst-font-size">'font-size'</span> and a <span
class="propinst-line-height">'line-height'</span> property, even if
they are not used directly to determine the height of the box. The
<span class="propinst-font-size">'font-size'</span> is, however, used
to define the 'em' and 'ex' units, and the 'line-height' has a role in
the <span class="propinst-vertical-align">'vertical-align'</span>
property.
<div class="example"><P>
The three rules in the example below have the same resultant line height:
<PRE>
DIV { line-height: 1.2; font-size: 10pt } /* number */
DIV { line-height: 1.2em; font-size: 10pt } /* length */
DIV { line-height: 120%; font-size: 10pt } /* percentage */
</PRE>
</div>
<P>When an element contains text that is rendered in more than one
font, user agents should determine the <span
class="propinst-line-height">'line-height'</span> value according to
the largest font size. <!-- change this if font-size inheritance is
changed as per HWL's proposal -->
<P>Generally, when there is only one value of <span
class="propinst-line-height">'line-height'</span> for all inline
boxes in a paragraph (and no tall images), the above will ensure that
baselines of successive lines are exactly <span
class="propinst-line-height">'line-height'</span> apart. This is
important when columns of text in different fonts have to be aligned,
for example in a table.
<!-- #include src=properties/vertical-align.srb -->
<P>This property affects the vertical positioning inside a line box of
the boxes generated by an inline-level element. The following values
only have meaning with respect to a parent inline-level element, or to
a parent block-level element, if that element generates <a
href="visuren.html#anonymous">anonymous inline boxes</a>; they have no
effect if no such parent exists</P>
<div class="note"><P>
<em><strong>Note.</strong> Values of this property have
slightly different meanings in the context of tables.
Please consult the section on <a href="tables.html#vertical-align">
vertical alignment of table context</a> for details.
</em>
</div>
<DL>
<DT><strong>baseline</strong>
<DD>Align the baseline of the box with the baseline of
the parent box. If the box doesn't have a baseline,
align the bottom of the box with the parent's baseline.
<DT><strong>middle</strong>
<DD>Align the vertical midpoint of the box with the baseline
of the parent box plus half the x-height of the parent.
<DT><strong>sub</strong>
<DD>Lower the baseline of the box to the proper position for
subscripts of the parent's box. (This value has no effect on the
font size of the element's text.)
<DT><strong>super</strong>
<DD>Raise the baseline of the box to the proper position for
superscripts of the parent's box. (This value has no effect on the
font size of the element's text.)
<DT><strong>text-top</strong>
<DD>Align the top of the box with the top of the parent element's font.
<DT><strong>text-bottom</strong>
<DD>Align the bottom of the box with the bottom of the parent
element's font.
<DT><span class="index-inst" title="<percentage>"><span
class="value-inst-percentage"><strong><percentage>
</strong></span></span>
<DD>Raise (positive value) or lower (negative value) the box
by this distance (a percentage of the <span
class="propinst-line-height">'line-height'</span> value).
The value '0%' means the same as 'baseline'.
<DT><span class="index-inst" title="<length>"><span
class="value-inst-length"><strong><length>
</strong></span></span>
<DD>Raise (positive value) or lower (negative value) the box
by this distance.
The value '0cm' means the same as 'baseline'.
</DL>
<P>The remaining values refer to the line box in which the
generated box appears:</p>
<DL>
<DT><strong>top</strong>
<DD>Align the top of the box with the top of the line box.
<DT><strong>bottom</strong>
<DD>Align the bottom of the box with the bottom of the line box.
</DL>
</BODY>
</HTML>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:nil
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:nil
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
You can’t perform that action at this time.