flexbox-min-height-auto-002b.html (2868B)
1 <!DOCTYPE html> 2 <!-- 3 Any copyright is dedicated to the Public Domain. 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --> 6 <html> 7 <head> 8 <meta charset="utf-8"> 9 <title>CSS Test: Testing min-height:auto</title> 10 <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> 11 <link rel="help" href="http://www.w3.org/TR/css-flexbox-1/#min-size-auto"> 12 <link rel="match" href="flexbox-min-height-auto-002-ref.html"> 13 <!-- 14 This testcase tests the used value of "min-height:auto" (the property's 15 initial value) on flex items in a vertical flex container. 16 17 It's supposed to resolve to the smallest of: 18 a) The used 'flex-basis' (taken from 'height'), if 'flex-basis' is at its 19 initial value. 20 b) The computed 'max-height' property 21 c) If there's no intrinsic aspect ratio: the item's min-content height. 22 d) If there is an intrinsic aspect ratio: the item's height derived from 23 the ratio & constraints in the other dimension. 24 25 We measure what the used value is by putting flex items in a small flex 26 container, which will shrink its items down to their min-height. 27 28 This test checks for situations where we should resolve the min-height as 29 (d) above, with "constraints in the other dimension" being "min-width". 30 --> 31 <style> 32 .flexbox { 33 display: flex; 34 flex-direction: column; 35 max-width: 34px; /* Constrain the flex container's cross size. */ 36 height: 1px; /* No available space; shrink flex items to min-height */ 37 margin-right: 2px; /* (Just for spacing things out, visually) */ 38 float: left; 39 } 40 41 .flexbox > * { 42 /* Flex items have purple border: */ 43 border: 2px dotted purple; 44 /* Flex items have sizing constraint in cross axis: */ 45 min-width: 30px; 46 } 47 </style> 48 </head> 49 <body> 50 <!-- Check for min-height:auto resolving correctly when the smallest 51 candidate value is: --> 52 53 <!-- *** (d) (with intrinsic aspect ratio) The height derived from ratio 54 and constraints in the other dimension *** --> 55 <!-- First, with a larger candidate 'flex-basis' value (from 'height') --> 56 <div class="flexbox"> 57 <img style="height: 100px" src="support/solidblue.png" alt="blue square"> 58 </div> 59 <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't 60 be considered for 'min-height:auto' anyway) --> 61 <div class="flexbox"> 62 <img style="flex-basis: 100px" src="support/solidblue.png" alt="blue square"> 63 </div> 64 <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't 65 be considered for 'min-height:auto' anyway) --> 66 <div class="flexbox"> 67 <img style="flex-basis: 10px" src="support/solidblue.png" alt="blue square"> 68 </div> 69 </body> 70 </html>