-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.bs
679 lines (555 loc) · 27.2 KB
/
Overview.bs
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
<h1>CSS Intrinsic & Extrinsic Sizing Module Level 3</h1>
<pre class='metadata'>
Shortname: css-sizing
Level: 3
Status: WD
Work Status: Revising
Group: csswg
ED: https://drafts.csswg.org/css-sizing-3/
TR: https://www.w3.org/TR/css-sizing-3/
Editor: Tab Atkins, Google, http://xanthir.com/contact/
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact, w3cid 35400
Previous version: https://www.w3.org/TR/2016/WD-css-sizing-3-20160512/
Abstract: This module extends the CSS sizing properties with keywords that represent content-based "intrinsic" sizes and context-based "extrinsic" sizes, allowing CSS to more easily describe boxes that fit their content or fit into a particular layout context.
Ignored Terms: block-level box
</pre>
<pre class='link-defaults'>
spec:css-display-3; type:property; text:display
spec:css-display-3; type:dfn; text:box
spec:css21; type: property
text: min-width
text: min-height
text: max-width
text: max-height
</pre>
<!-- Notes on stuff to do... [copy/pasted from etherpad, probably out-of-date, evaluate later]
Swap definition of preferred size in for max-content.
Define current max-content as super-max-content.
Mark an isssue about whether it's a necessary concept;
I'm unsure, but I think it will show up in orthogonal flow sizing.
-->
<h2 id="intro">
Introduction</h2>
<p><em>This section is not normative.</em>
<p>
CSS layout has several different concepts of automatic sizing that are used in various layout calculations.
This section defines some more precise terminology
to help connect the layout behaviors of this spec to the calculations used in other modules,
and some new keywords for the 'width' and 'height' properties
to allow authors to assign elements the dimensions resulting from these size calculations.
<h3 id="placement">
Module interactions</h3>
<p>This module extends the 'width', 'height', 'min-width', 'min-height', 'max-width', 'max-height', and 'column-width'
features defined in [[!CSS2]] chapter 10 and in [[!CSS3COL]]
<h3 id="values">
Values</h3>
This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]].
Value types not defined in this specification are defined in CSS Values & Units [[!CSS-VALUES-3]].
Other CSS modules may expand the definitions of these value types.
In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the <a>CSS-wide keywords</a> keywords as their property value.
For readability they have not been repeated explicitly.
<h2 id="terms">
Terminology</h2>
<dl export>
<dt><dfn>size</dfn>
<dd>
A one- or two-dimensional measurement:
a <a>block size</a> and/or <a>inline size</a>;
alternatively a width and/or height.
<dt><dfn>inner size</dfn>
<dd>
The <a href="https://www.w3.org/TR/css2/box.html#box-dimensions">content-box</a> size of a <a>box</a>.
<dt><dfn>outer size</dfn>
<dd>
The <a href="https://www.w3.org/TR/css2/box.html#box-dimensions">margin-box</a> size of a <a>box</a>.
<dt><dfn id="definite" lt="definite|definite size">definite size</dfn>
<dd>
A size that can be determined without performing layout;
that is, a <<length>>,
a measure of text (without consideration of line-wrapping),
a size of the <a>initial containing block</a>,
or a <<percentage>> or other formula
(such the <a href="https://www.w3.org/TR/CSS2/visudet.html#blockwidth">“stretch-fit” sizing of non-replaced blocks</a> [[CSS2]])
that is resolved solely against <a>definite</a> sizes.
Additionally, the size of the <a>containing block</a> of an absolutely positioned element is always <a>definite</a>
with respect to that element.
<dt><dfn id="indefinite" lt="indefinite|indefinite size">indefinite size</dfn>
<dd>
A size that is not <a>definite</a>.
<a>Indefinite</a> <a>available space</a> is essentially infinite.
<dt><dfn id="available" local-lt="available" lt="available space|available inline space|available block space">available space</dfn>
<dd>
A size representing the space into which a box is laid out,
as determined by
the rules of the formatting context in which it participates.
The space available to a box is usually
either a measurement of its <a>containing block</a> (if that is <a>definite</a>)
or an infinite size (when it is <a>indefinite</a>).
<a>Available space</a> can alternatively be either a
<a>min-content constraint</a> or
a <a>max-content constraint</a>.
<!--
<p>
The space <a>available</a> to a box is determined by the formatting context in which it participates.
In block, table, and inline formatting contexts [[!CSS2]],
the <a>available space</a> is infinite in the block-axis dimension.
<span class="issue">What, exactly, is the available space in the inline axis??? What about other formatting models?</span>
-->
<dt><dfn>stretch fit</dfn>
<dd>
The <a>stretch fit</a> into a given size
is that size,
minus the element's computed margins (not collapsed, treating ''margin/auto'' as zero),
border, and padding in the given dimension
(such that the outer size is a perfect fit),
and flooring at zero
(so that the inner size is not negative).
<p class='note'>
Note: This is the formula used to calculate the ''width/auto'' widths
of non-replaced blocks in normal flow in <a href="https://www.w3.org/TR/CSS2/visudet.html#blockwidth">CSS2.1§10.3.3</a>.
<dt><dfn lt="fallback|fallback size">fallback size</dfn>
<dd>
Some sizing algorithms do not work well with an infinite size.
In these cases, the <a>fallback size</a> is used instead.
Unless otherwise specified,
this is the size of the <a>initial containing block</a>.
</dl>
<h3 id='auto-box-sizes'>
Auto Box Sizes</h3>
<div export>
: <dfn>stretch-fit size</dfn>
: <dfn>stretch-fit inline size</dfn>
: <dfn>stretch-fit block size</dfn>
:: Roughly, the <a>size</a> a box would take
if it filled the <a>available space</a>
in the given axis.
(See [[#extrinsic]].)
Note: For the <a>inline axis</a>, this is called the “available width” in <a href="https://www.w3.org/TR/CSS2/visudet.html#float-width">CSS2.1§10.3.5</a>
and computed by the rules in <a href="https://www.w3.org/TR/CSS2/visudet.html#blockwidth">CSS2.1§10.3.3</a>.
: <dfn lt="max-content | max-content size">max-content size</dfn>
:: A box’s “ideal” <a>size</a> in a given axis when given infinite available space.
Usually this is the smallest <a>size</a> the box could take in that axis
while still fitting around its contents,
i.e. minimizing unfilled space while avoiding overflow.
: <dfn>max-content inline size</dfn>
:: The box's “ideal” <a>size</a> in the <a>inline axis</a>.
Usually the narrowest <a>inline size</a> it could take while fitting around its contents
if <em>none</em> of the soft wrap opportunities within the box were taken.
(See [[#intrinsic]].)
Note: This is called the “preferred width” in <a href="https://www.w3.org/TR/CSS2/visudet.html#float-width">CSS2.1§10.3.5</a>
and the “maximum cell width” in <a href="https://www.w3.org/TR/CSS2/tables.html#auto-table-layout">CSS2.1§17.5.2.2</a>.
: <dfn>max-content block size</dfn>
:: The box's “ideal” <a>size</a> in the <a>block axis</a>.
Usually the <a>block size</a> of the content after layout.
: <dfn lt="min-content | min-content size">min-content size</dfn>
:: The smallest <a>size</a> a box could take
that doesn't lead to overflow
that could be avoided by choosing a larger <a>size</a>.
(See [[#intrinsic]].)
: <dfn>min-content inline size</dfn>
:: The narrowest <a>inline size</a> a box could take
that doesn't lead to inline-dimension overflow
that could be avoided by choosing a larger <a>inline size</a>.
Roughly, the <a>inline size</a> that would fit around its contents
if <em>all</em> soft wrap opportunities within the box were taken.
Note: This is called the “preferred minimum width” in <a href="https://www.w3.org/TR/CSS2/visudet.html#float-width">CSS2.1§10.3.5</a>
and the “minimum content width” in <a href="https://www.w3.org/TR/CSS2/tables.html#auto-table-layout">CSS2.1§17.5.2.2</a>.
: <dfn>min-content block size</dfn>
:: Equivalent to the <a>max-content block size</a>.
Issue: Or should this be the minimum between allowed break points?
It might make sense in multi-col contexts
to have min-content and max-content block-sizes be different,
even if they are the same elsewhere.
: <dfn>fit-content size</dfn>
: <dfn>fit-content inline size</dfn>
: <dfn>fit-content block size</dfn>
:: If the <a>available space</a> in a given axis is finite,
equal to <code>min(<a>max-content size</a>, max(<a>min-content size</a>, <a>stretch-fit size</a>))</code>.
Otherwise, equal to the <a>max-content size</a> in that axis.
Note: This is called the “shrink-to-fit” width in <a href="https://www.w3.org/TR/CSS2/visudet.html#float-width">CSS2.1§10.3.5</a>
and <a href="https://www.w3.org/TR/css3-multicol/#pseudo-algorithm">CSS Multi-column Layout § 3.4</a>.
</div>
<h3 id='contributions' dfn export lt="intrinsic size contribution">
Intrinsic Size Contributions</h3>
<dl export>
<dt><dfn lt="max-content contribution|max-content inline-size contribution|max-content block-size contribution">max-content contribution</dfn>
<dd>
The size that a box contributes to its <a>containing block</a>'s <a>max-content size</a>.
<dt><dfn lt="min-content contribution|min-content inline-size contribution|min-content block-size contribution">min-content contribution</dfn>
<dd>
The size that a box contributes to its <a>containing block</a>'s <a>min-content size</a>.
</dl>
Intrinsic size contributions are based on the <a>outer size</a> of the box;
for this purpose ''margin/auto'' margins are treated as zero.
<h3 id='constraints' dfn export lt="intrinsic size constraint">
Intrinsic Size Constraints</h3>
<dl export>
<dt><dfn>max-content constraint</dfn>
<dd>
A sizing constraint imposed by the box's <a>containing block</a>
that causes it to produce its <a>max-content contribution</a>.
<dt><dfn>min-content constraint</dfn>
<dd>
A sizing constraint imposed by the box's <a>containing block</a>
that causes it to produce its <a>min-content contribution</a>.
</dl>
<h2 id='size-keywords'>
New Sizing Keywords</h2>
<h3 id='width-height-keywords'>
New Keywords for 'width' and 'height'</h3>
<pre class=propdef partial>
Name: width, min-width, max-width, height, min-height, max-height
New values: stretch | max-content | min-content | fit-content | fit-content(<<length-percentage>>)
</pre>
<p>There are four types of automatically-determined sizes in CSS (which
are represented in the width and height properties by the keywords
defined above):
<dl dfn-type=value dfn-for="width, min-width, max-width, height, min-height, max-height">
<dt><dfn>stretch</dfn>
<dd>
Use the <a>stretch-fit inline size</a> or <a>stretch-fit block size</a>,
as appropriate to the writing mode.
NOTE: This is the formula used to calculate ''width/auto'' widths
for non-replaced blocks in normal flow, see <a href="https://www.w3.org/TR/CSS2/visudet.html#blockwidth">CSS2.1§10.3.3</a>.
It allows re-using this formula for boxes that are otherwise shrink-wrapped,
like tables.
<dt><dfn>max-content</dfn>
<dd>
If specified for the inline axis,
use the <a>max-content inline size</a>;
otherwise compute to the property’s <a>initial value</a>.
<dt><dfn>min-content</dfn>
<dd>
If specified for the inline axis,
use the <a>min-content inline size</a>;
otherwise compute to the property’s <a>initial value</a>.
<dt><dfn>fit-content</dfn>
<dd>
If specified for the inline axis,
use the <a>max-content inline size</a>
i.e.
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <a>stretch-fit size</a>))</code>;
otherwise compute to the property’s <a>initial value</a>.
<dt><dfn>fit-content(<<length-percentage>>)</dfn>
<dd>
If specified for the inline axis,
use the fit-content formula
with the <a>available space</a> replaced by the specified argument,
i.e.
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <<length-percentage>>))</code>;
otherwise compute to the property’s <a>initial value</a>.
</dl>
Issue: Is ''width/stretch'' stable enough or should we defer to L4?
Note: To size an element such that it avoids overlapping sibling floats,
make sure it's a <a>formatting context</a> root.
For some layout modes, such as Grid and Flexbox,
this is true automatically.
For Block layout, this means using ''display: flow-root;''.
Note: Percentages resolved against the intrinsic sizes
(''width/max-content'', ''width/min-content'', ''width/fit-content'')
will behave as ''width/auto''.
<!-- <a href="https://www.w3.org/TR/CSS2/visudet.html#the-height-property">as defined by CSS 2</a>. [[!CSS2]] -->
<!-- Restore the above when 2.1 is updated and published with the new "behaves as" text we resolved on. -->
To have a common term for both when
'width'/'height' computes to ''width/auto''
and when it is defined to behave as ''width/auto''
(as in the case above),
the property is said to <dfn export lt="behave as auto|behaves as auto|behaving as auto">behave as auto</dfn>
in both of these cases.
Note: Legacy spec prose defining layout behavior
might explicitly refer to 'width'/'height' having a computed value of ''width/auto'' as a condition;
these should be interpreted as meaning <a>behaves as auto</a>,
and reported to the CSSWG for updating.
<h3 id='the-contain-floats-value'>
Containing Floats</h3>
Note: To ensure that a container sizes itself to contain any descendant floats,
make sure it's a <a>formatting context</a> root.
For some layout modes, such as Grid and Flexbox,
this is true automatically.
For Block layout, this means using ''display: flow-root;''.
<h3 id='column-sizing'>
Column Sizing Keywords</h3>
<pre class="propdef partial">
Name: column-width
New values: stretch | max-content | min-content | fit-content | fit-content(<<length-percentage>>)
</pre>
<p>When used as values for 'column-width',
the new keywords specify the optimal column width:
<dl dfn-type=value dfn-for="column-width">
<dt><dfn>stretch</dfn>
<dd>Specifies the optimal column width as the <a>stretch-fit inline size</a>
of the multi-column element.
<dt><dfn>max-content</dfn>
<dd>Specifies the optimal column width as the <a>max-content inline size</a>
of the multi-column element's contents.
<dt><dfn>min-content</dfn>
<dd>Specifies the optimal column width as the <a>min-content inline size</a>
of the multi-column element's contents.
<dt><dfn>fit-content</dfn>
<dd>Specifies the optimal column width as
<code>min(<a>max-content inline size</a>, max(<a>min-content inline size</a>, <a>stretch-fit inline size</a>))</code>.
<dt><dfn>fit-content(<<length-percentage>>)</dfn>
<dd>
Specifies the optimal column width as
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <<length-percentage>>))</code>
</dl>
<h2 id='intrinsic'>
Intrinsic Size Determination</h2>
<p>
<dfn export>Intrinsic sizing</dfn> determines sizes based on the contents of an element,
without regard for its context.
<h3 id='intrinsic-sizes'>
Intrinsic Sizes</h3>
The <a>min-content size</a> of a box in each axis
is the size it would have as an
''width/auto''-sized (in that axis) float in a zero-sized containing block.
(In other words, the minimum size it has when sized as “shrink-to-fit”.)
The <a>max-content size</a> of a box in each axis
is the size it would have as an
''width/auto''-sized (in that axis) float in an infinitely-sized containing block.
(In other words, the maximum size it has when sized as “shrink-to-fit”.)
If this size would depend on the size of the containing block
(as it does for images with an intrinsic aspect ratio but no intrinsic size)
and therefore can't be calculated against an infinitely-sized containing block
then:
<dl>
<dt>For boxes with an intrinsic aspect ratio, but no intrinsic size:
<dd>
* If the <a>available space</a> is <a>definite</a>
in the <a>inline axis</a>,
use the <a>stretch fit</a> into that size for the inline size
and calculate the block size using the aspect ratio.
* Otherwise
use a width of ''300px''
(height of ''150px'' in <a>vertical writing modes</a>)
and calculate the other dimension using the aspect ratio.
<dt>For boxes without an intrinsic aspect ratio:
<dd>
* If the <a>available space</a> is <a>definite</a>
in the appropriate dimension,
use the <a>stretch fit</a> into that size in that dimension.
* Otherwise,
use ''300px'' for the width
and/or ''150px'' for the height
as needed.
</dl>
Note: This specification does not define how to determine
the size of a float.
Please refer to [[CSS2]],
the relevant CSS specification for that display type,
and/or existing implementations
for further details.
<h3 id="intrinsic-contribution">
Intrinsic Contributions</h3>
A box’s <a>min-content contribution</a>/<a>max-content contribution</a> in each axis
is the size of the content box
of a hypothetical ''width/auto''-sized float
that contains only that box,
if that hypothetical float's containing block is zero-sized/infinitely-sized.
However, in the case of a [=replaced element|replaced=] box with a percentage-based 'width'/'max-width'/'height'/'max-height',
the percentage is resolved to zero
when calculating the <a>min-content contribution</a> in the corresponding axis.
<div class=example>
For example,
an <{input}> assigned ''width: calc(50% + 50px)''
has a <a>min-content contribution</a> of ''50px'',
plus any horizontal margin/border/padding.
</div>
Note: We are not 100% sure if zeroing out a percentage 'max-width' on form controls is web-compatible.
See <a href="https://github.com/w3c/csswg-drafts/issues/765">Issue 765</a>.
Note: This specification does not define how to determine these sizes.
Please refer to [[CSS2]],
the relevant CSS specification for that display type,
and/or existing implementations
for further details.
<h2 id='extrinsic'>
Extrinsic Size Determination</h2>
<p>
<dfn export>Extrinsic sizing</dfn> determines sizes based on the context of an element,
without regard for its contents.
<h3 id="stretch-fit-sizing">
Stretch-fit Sizing</h3>
The inner <a>stretch-fit inline size</a> of a box is…
<!-- Based on https://lists.w3.org/Archives/Public/www-style/2009Nov/0286.html -->
<ul>
<li>
If the box is the root or is absolutely-positioned, the inline-size of its containing block, else
<li>
<code>max('min-inline-size'|0, min('max-inline-size'|infinity, 'inline-size'|<a>stretch-fit inline size</a>))</code>
where the sizes are inner inline-sizes of the element establishing the box's <a>containing block</a>,
and where the first value is used if it is <a>definite</a> and the second value otherwise.
</ul>
…less the box's <a>inline-axis</a> margins
(after any <a href="https://www.w3.org/TR/CSS2/box.html#collapsing-margins">margin collapsing</a>, and treating ''margin/auto'' margins as zero),
borders, and padding,
flooring at zero.
Issue: Shouldn't this be ignoring margin collapsing?
<p>
The <a>stretch-fit block size</a> of a box is defined analogously,
but in the other dimension.
<p class='issue'>
This definition might end up skipping further up the ancestor chain than we'd like in some cases.
<a href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0204.html">Example.</a>
Maybe it should stop at each formatting root, or something similar?
<h3 id="percentage-sizing">
Percentage Sizing</h3>
Percentages specify sizing of a box with respect to the box’s <a>containing block</a>.
<div class="example">
For example, in the following markup:
<xmp class='lang-html'>
<article style="height: 60em">
<aside style="height: 50%;">
</aside>
</article>
</xmp>
the <code><aside></code> would be 30em tall.
</div>
Sometimes the size of a percentage-sized box's containing block
depends on the intrinsic size contribution of the box itself,
creating a cyclic dependency.
When calculating the containing block's size,
the percentage <a>behaves as auto</a>.
Then, unless otherwise specified,
when calculating the used sizes and positions of the containing block’s <em>contents</em>:
* If the cyclic dependency was introduced due to
a 'block-size' or 'max-block-size' on the containing block
that causes it to depend on the size of its contents,
the box’s percentage is not resolved and instead <a>behaves as auto</a>.
Note: <a href="https://www.w3.org/TR/css-grid/">Grid containers</a> (<a href="https://github.com/w3c/csswg-drafts/issues/1679">and flex items?</a>) do allow percentages to resolve in this case.
* Otherwise, the percentage is resolved against the containing block’s size.
(The containing block’s size is not re-resolved based on the resulting size of the box;
the contents might thus overflow or underflow the containing block).
Note: These rules specify the previously-undefined behavior of this cyclic case in <a href="https://www.w3.org/TR/CSS2/visudet.html#the-width-property">CSS2§10.2</a>.
Note also, the behavior in <a href="https://www.w3.org/TR/CSS2/visudet.html#the-height-property">CSS2§10.5</a>
is superseded in their respective specifications for layout modes
(such as <a href="http://www.w3.org/TR/css-flexbox/">flex layout</a>)
not described in CSS2.
Similarly, percentage margins and padding behave as zero in such cyclic cases
when calculating the containing block's size,
and then resolve when calculating the used sizes and positions of its content.
(This defines the previously-undefined behavior of this cyclic case in
<a href="https://www.w3.org/TR/CSS2/box.html#margin-properties">CSS2§8.3</a>
and
<a href="https://www.w3.org/TR/CSS2/box.padding-properties">CSS2§8.4</a>.
<div class="example">
For example, in the following markup:
<xmp class='lang-html'>
<article style="width: min-content">
<aside style="width: 50%;">
LOOOOOOOOOOOOOOOOOOOONG
</aside>
</article>
</xmp>
When calculating the width of the outer <code><article></code>,
the inner <code><aside></code> behaves as ''width: auto'',
so the <code><article></code> sets itself to the width of the long word.
Since the <code><article></code>’s width didn't depend on "real" layout,
though, it's treated as <a>definite</a>
for resolving the <code><aside></code>,
whose width resolves to half that of the <code><article></code>.
</div>
<div class="example">
In this example,
<xmp class=lang-html>
<article style="height:auto">
<aside style="height: 50%;">
<div class=block style="height: 150px;"></div>
</aside>
<section style="height: 30px;"></section>
</article>
</xmp>
because the percentage <a>block size</a> ('height', in this case) on block-level elements
is defined to not resolve inside content-sized containing blocks,
the percentage height on the <code><aside></code> is ignored,
that is, it behaves exactly as if ''height/auto'' were specified.
</div>
<div class=example>
Issue: Letting %s still resolve against a definite 'height'
when the min-height is intrinsic is an open issue.
(CSS2 has a general statement about "height depending on contents",
which this technically is,
even though CSS2 didn't have content-dependent keywords for 'min-height'.
Since this is new, we think we could have this different behavior.)
The following examples illustrate how block-axis percentages resolve against a containing block whose size depends on its contents.
<xmp class=lang-html>
<article style="height:100px; min-height: min-content;">
<aside style="height: 50%;">
<div style="height: 150px;"></div>
</aside>
<section style="height: 30px;"></section>
</article>
</xmp>
The initial height of the <code><article></code> is 100px, as specified,
which would make the <code><aside></code> 50px tall
when it resolved its percentage.
However, we must calculate the min-height,
by substituting it in for 'height'.
This causes the percentage on the <code><aside></code> to <a>behave as auto</a>,
so the <code><aside></code> ends up 150px tall.
The total height of the contents is thus 180px.
This is larger than the specified 100px height,
so the <code><article></code> gets adjusted to 180px tall.
Then, since the percentage could <em>originally</em> resolve against the (100px) height,
it now resolves against the 180px height,
so the <code><aside></code> ends up being 90px tall.
<xmp class=lang-html>
<article style="height:auto; min-height: min-content;">
<aside style="height: 50%;">
<div class=block style="height: 150px;"></div>
</aside>
<section style="height: 30px;"></section>
</article>
</xmp>
In this case, the percentage on the <code><aside></code> won't normally resolve,
because the containing block's height is ''height/auto''
(and thus depends on the size of its contents).
Instead it <a>behaves as auto</a>,
resulting in a height of 150px for the <code><aside></code>,
and an initial height of 180px for the <code><article></code>
The 'min-height' doesn't change this;
''height: min-content;'' acts similarly to ''height: auto;''
and results in the same sizes.
<xmp class=lang-html>
<article style="height:100px; min-height: min-content;">
<aside style="height: 200%;">
<div style="height: 150px;"></div>
</aside>
<section style="height: 30px;"></section>
</article>
</xmp>
This is a variation on the first code block,
and follows a similar path;
the <code><aside></code> initially wants to compute to 200px tall
(200% of the 100px containing block height).
When we calculate the effects of 'min-height',
the percentage <a>behaves as auto</a>,
causing it to become 150px tall,
and the total ''height/min-content'' height of the containing block
to be 180px tall.
Since this is larger than 100px,
the <code><article></code> gets clamped to 180px,
the percentage resolves against this new height,
and the <code><aside></code> ends up being 360px tall,
overflowing the <code><article></code>
</div>
<h2 class=no-num id="changes">
Changes</h2>
<p>
Significant changes since the <a href="https://www.w3.org/TR/2017/WD-css-sizing-3-20170207/">7 February 2017 Working Draft</a> include:
<ul>
<li>More accurate definition of min-content and max-content sizes for replaced elements.
<li>Compute new keywords to the initial value, not to a potentially non-existent ''width/auto'', when applied to the block axis.
<li>Specify that percent sizes on replaced elements zero out their min-content contribution.
<li>Fix confusing/wrong definition of percentage sizes resolved against a dependent containing block.
<li>
ISSUE: Drop ''width/stretch'' for now?
</ul>
<h2 class=no-num id="acknowledgments">
Acknowledgments</h2>
<p>Special thanks go to Aaron Gustafson, L. David Baron
for their contributions to this module.
<h2 class=no-num id=priv-sec>
Privacy and Security Considerations</h2>
This specification introduces no new privacy or security considerations.