@@ -205,63 +205,6 @@ Intrinsic Aspect Ratios: the 'aspect-ratio' property</h3>
205205 need to figure out specific cases that are unclear and define them,
206206 either in the appropriate Level 3 spec or here.
207207
208- When a box has a [=preferred aspect ratio=] ,
209- its <a>automatic sizes</a>
210- are calculated the same as for
211- a <a>replaced element</a> with an <a>intrinsic aspect ratio</a>
212- and no <a>intrinsic dimension</a> in that axis,
213- see e.g. <a href="https://www.w3.org/TR/CSS2/visudet.html">CSS2 § 10</a>
214- and <a href="https://www.w3.org/TR/css-flexbox-1/#algo-main-item">CSS Flexible Box Model Level 1 § 9.2</a> .
215- The axis in which the <a>preferred size</a> calculation
216- depends on this aspect ratio
217- is called the <dfn export>ratio-dependent axis</dfn> ,
218- and the resulting size is <a>definite</a>
219- if its input sizes are also <a>definite</a> .
220- The opposite axis (on which the [=ratio-dependent axis=] size depends)
221- is the <dfn export>ratio-determining axis</dfn> .
222-
223- Note: A [=preferred aspect ratio=]
224- only ever has an effect if at least one of the box's sizes
225- is [=automatic size|automatic=] .
226- If neither 'width' nor 'height' is an [=automatic size=] ,
227- it can have no effect on its [=preferred sizes=] .
228-
229- For the purpose of margin collapsing ([[css2/box#collapsing-margins]] ),
230- if the [=block axis=] is the [=ratio-dependent axis=] ,
231- it is not considered to have a [=computed value|computed=] 'block-size' of ''height/auto'' .
232-
233- If a replaced element's only [=intrinsic dimension=]
234- is an intrinsic width or an intrinsic height,
235- giving it a [=preferred aspect ratio=]
236- also gives it an intrinsic height or width,
237- whichever was missing,
238- by transferring the existing size
239- through the [=preferred aspect ratio=] .
240-
241- Additionally, sizing constraints in either axis
242- (the <var> origin</var> axis)
243- are transferred through the [=preferred aspect ratio=]
244- to the other axis (the <var> destination</var> axis)
245- as follows:
246-
247- * First, any [=definite=] [=minimum size=] is converted and transferred
248- from the <var> origin</var> to <var> destination</var> axis.
249- This transferred minimum is capped
250- by any [=definite=] [=preferred size|preferred=] or [=maximum size=]
251- in the <var> destination</var> axis.
252- * Then, any [=definite=] [=maximum size=] is converted and transferred
253- from the <var> origin</var> to <var> destination</var> .
254- This transferred maximum is floored
255- by any [=definite=] [=preferred size|preferred=] or [=minimum size=]
256- in the <var> destination</var> axis
257- as well as by the transferred minimum, if any.
258-
259- Note: The basic principle is that sizing constraints
260- transfer through the aspect-ratio to the other side
261- to preserve the aspect ratio to the extent that they can
262- without violating any sizes specified explictly on that affected axis.
263- <!-- This is the principle that drove the contents of the table in CSS2 Section 10.4. -->
264-
265208 <div class="example">
266209 This example sets each item in the grid to render as a square,
267210 determining the number of items and their widths by the available space.
@@ -310,73 +253,50 @@ Intrinsic Aspect Ratios: the 'aspect-ratio' property</h3>
310253 </pre>
311254 </div>
312255
313- <div class="example">
314- In the following example:
315-
316- <pre highlight=html>
317- <div id=container style="height: 100px; float: left;">
318- <div id=item style="height: 100%; aspect-ratio: 1/1;">content</div>
319- </div>
320- </pre>
256+ <h4 id="aspect-ratio-intrinsic-replaced">
257+ Intrinsic Sizes Of Replaced Elements</h4>
321258
322- Since the height of the <code> #item</code> is a percentage that resolves against a definite container,
323- the width of the item resolves to 100px for both its intrinsic size contributions as well as for final layout,
324- so the container also sizes to a width of 100px.
325-
326- <pre highlight=html>
327- <div id=container style="height: auto; float: left;">
328- <div id=item style="height: 100%; aspect-ratio: 1/1;">content</div>
329- </div>
330- </pre>
331-
332- In this next example,
333- the percentage height of the item cannot be resolved and [=behaves as auto=]
334- (see [[CSS2/visudet#the-height-property]] ).
335- Since both axes now have an [=automatic size=] ,
336- the height becomes the [=ratio-dependent axis=] .
337- Calculating the [=intrinsic size contributions=] of the box
338- produces a width derived from its content,
339- and a height calculated from that width and the aspect ratio,
340- yielding a square box (and a container) sized
341- to the width of the word “content”.
342- </div>
343-
344- <h4 id='aspect-ratio-cyclic'>
345- Cyclic Aspect-Ratio Calculations</h4>
259+ If a replaced element's only [=intrinsic dimension=]
260+ is an intrinsic width or an intrinsic height,
261+ giving it a [=preferred aspect ratio=]
262+ also gives it an intrinsic height or width,
263+ whichever was missing,
264+ by transferring the existing size
265+ through the [=preferred aspect ratio=] .
346266
347- On non-replaced elements with an ''width/auto'' <a>inline size</a>
348- (or any replaced element whose intrinsic <a>block size</a>
349- depends on its <a>inline size</a> ),
350- the intrinsic <a>block sizes</a> of the box
351- are assumed to be zero
352- when applying 'min-block-size' to the aspect ratio calculations,
353- and assumed to be infinity
354- when applying 'max-block-size' to the aspect ratio calculations.
355- These limits take effect as usual for non-replaced elements
356- once the <a>inline size</a> is resolved.
267+ <h3 id="aspect-ratio-automatic">
268+ Automatic Sizes In The Presence Of A Preferred Aspect Ratio</h3>
357269
358- <div class="example">
359- For example, given a (<a>horizontal writing mode</a> ) element with
360- <pre>
361- width: auto;
362- min-height: min-content;
363- aspect-ratio: 1/1;
364- </pre>
270+ When a box has a [=preferred aspect ratio=] ,
271+ its <a>automatic sizes</a>
272+ are calculated the same as for
273+ a <a>replaced element</a> with an <a>intrinsic aspect ratio</a>
274+ and no <a>intrinsic dimension</a> in that axis,
275+ see e.g. <a href="https://www.w3.org/TR/CSS2/visudet.html">CSS2 § 10</a>
276+ and <a href="https://www.w3.org/TR/css-flexbox-1/#algo-main-item">CSS Flexible Box Model Level 1 § 9.2</a> .
277+ The axis in which the <a>preferred size</a> calculation
278+ depends on this aspect ratio
279+ is called the <dfn export>ratio-dependent axis</dfn> ,
280+ and the resulting size is <a>definite</a>
281+ if its input sizes are also <a>definite</a> .
282+ The opposite axis (on which the [=ratio-dependent axis=] size depends)
283+ is the <dfn export>ratio-determining axis</dfn> .
365284
366- using the aspect ratio to resolve the width
367- would require knowing the min-content height of the element.
285+ Note: A [=preferred aspect ratio=]
286+ only ever has an effect if at least one of the box's sizes
287+ is [=automatic size|automatic=] .
288+ If neither 'width' nor 'height' is an [=automatic size=] ,
289+ it can have no effect on its [=preferred sizes=] .
368290
369- Since for a non-replaced element,
370- this value is not known until the width is resolved,
371- we assume the 'min-height' value is zero
372- while resolving the width.
291+ <h4 id="aspect-ratio-margin-collapse">
292+ Margin-collapse</h4>
373293
374- Then, once the width is known, we resolve the height ,
375- taking into account the ''height/min-content'' minimum.
376- </div>
294+ For the purpose of margin collapsing ( [[css2/box#collapsing-margins]] ) ,
295+ if the [=block axis=] is the [=ratio-dependent axis=] ,
296+ it is not considered to have a [=computed value|computed=] 'block-size' of ''height/auto'' .
377297
378- <h4 id="aspect-ratio-minimum">
379- Automatic Content-based Minimum Sizes</h4 >
298+ <h3 id="aspect-ratio-minimum">
299+ Automatic Content-based Minimum Sizes</h3 >
380300
381301 In order to avoid unintentional overflow,
382302 the <a>automatic minimum size</a> in the <a>ratio-dependent axis</a>
@@ -410,7 +330,8 @@ Automatic Content-based Minimum Sizes</h4>
410330 </pre>
411331
412332 When ''overflow: auto'' is specified, however,
413- even the box with excess content maintains the 1:1 aspect ratio.
333+ even the box with excess content maintains the 1:1 aspect ratio
334+ (and handles overflow by becoming scrollable instead, as usual).
414335
415336 <pre>
416337 div {
@@ -469,6 +390,98 @@ Automatic Content-based Minimum Sizes</h4>
469390 ''min-width: 0'' can be specified.
470391 </div>
471392
393+ <h3 id="aspect-ratio-size-transfers">
394+ Min/Max Size Transfers</h3>
395+
396+ Sizing constraints in either axis
397+ (the <var> origin</var> axis)
398+ are transferred through the [=preferred aspect ratio=]
399+ to the other axis (the <var> destination</var> axis)
400+ as follows:
401+
402+ * First, any [=definite=] [=minimum size=] is converted and transferred
403+ from the <var> origin</var> to <var> destination</var> axis.
404+ This transferred minimum is capped
405+ by any [=definite=] [=preferred size|preferred=] or [=maximum size=]
406+ in the <var> destination</var> axis.
407+ * Then, any [=definite=] [=maximum size=] is converted and transferred
408+ from the <var> origin</var> to <var> destination</var> .
409+ This transferred maximum is floored
410+ by any [=definite=] [=preferred size|preferred=] or [=minimum size=]
411+ in the <var> destination</var> axis
412+ as well as by the transferred minimum, if any.
413+
414+ Note: The basic principle is that sizing constraints
415+ transfer through the aspect-ratio to the other side
416+ to preserve the aspect ratio to the extent that they can
417+ without violating any sizes specified explictly on that affected axis.
418+ <!-- This is the principle that drove the contents of the table in CSS2 Section 10.4. -->
419+
420+ <div class="example">
421+ In the following example:
422+
423+ <pre highlight=html>
424+ <div id=container style="height: 100px; float: left;">
425+ <div id=item style="height: 100%; aspect-ratio: 1/1;">content</div>
426+ </div>
427+ </pre>
428+
429+ Since the height of the <code> #item</code> is a percentage that resolves against a definite container,
430+ the width of the item resolves to 100px for both its intrinsic size contributions as well as for final layout,
431+ so the container also sizes to a width of 100px.
432+
433+ <pre highlight=html>
434+ <div id=container style="height: auto; float: left;">
435+ <div id=item style="height: 100%; aspect-ratio: 1/1;">content</div>
436+ </div>
437+ </pre>
438+
439+ In this next example,
440+ the percentage height of the item cannot be resolved and [=behaves as auto=]
441+ (see [[CSS2/visudet#the-height-property]] ).
442+ Since both axes now have an [=automatic size=] ,
443+ the height becomes the [=ratio-dependent axis=] .
444+ Calculating the [=intrinsic size contributions=] of the box
445+ produces a width derived from its content,
446+ and a height calculated from that width and the aspect ratio,
447+ yielding a square box (and a container) sized
448+ to the width of the word “content”.
449+ </div>
450+
451+ <h4 id='aspect-ratio-cyclic'>
452+ Cyclic Aspect-Ratio Calculations</h4>
453+
454+ On non-replaced elements with an ''width/auto'' <a>inline size</a>
455+ (or any replaced element whose intrinsic <a>block size</a>
456+ depends on its <a>inline size</a> ),
457+ the intrinsic <a>block sizes</a> of the box
458+ are assumed to be zero
459+ when applying 'min-block-size' to the aspect ratio calculations,
460+ and assumed to be infinity
461+ when applying 'max-block-size' to the aspect ratio calculations.
462+ These limits take effect as usual for non-replaced elements
463+ once the <a>inline size</a> is resolved.
464+
465+ <div class="example">
466+ For example, given a (<a>horizontal writing mode</a> ) element with
467+ <pre>
468+ width: auto;
469+ min-height: min-content;
470+ aspect-ratio: 1/1;
471+ </pre>
472+
473+ using the aspect ratio to resolve the width
474+ would require knowing the min-content height of the element.
475+
476+ Since for a non-replaced element,
477+ this value is not known until the width is resolved,
478+ we assume the 'min-height' value is zero
479+ while resolving the width.
480+
481+ Then, once the width is known, we resolve the height,
482+ taking into account the ''height/min-content'' minimum.
483+ </div>
484+
472485<!--
473486████ ██ ██ ████████ ████████ ████ ██ ██ ██████ ████ ██████
474487 ██ ███ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██
0 commit comments