flex-minimum-height-flex-items-017.html (1150B)
1 <!DOCTYPE html> 2 <title>CSS Flexbox: min-height: auto with flex items containing percentage-sized children</title> 3 <link rel="author" title="Google LLC" href="https://www.google.com/" /> 4 <link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto" /> 5 <link rel="issue" href="https://bugs.chromium.org/p/chromium/issues/detail?id=998080" /> 6 <link rel="match" href="../reference/ref-filled-green-100px-square.xht" /> 7 8 <style> 9 .flexbox { 10 display: flex; 11 width: 100px; 12 height: 0; 13 flex-direction: column; 14 } 15 .item { 16 /* Because flex-basis is 0, we rely on min-height to size this item. 17 * We give it an explicit height so that percentages have a chance of 18 * resolving. We can't use 0 for the height because the min-height is 19 * basically min(height, min-content). */ 20 flex: 0 1 0px; 21 height: 100px; 22 background: green; 23 } 24 .percentage { 25 height: 100%; 26 } 27 .fixed { 28 height: 100px; 29 } 30 31 </style> 32 33 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 34 35 <div class="flexbox"> 36 <div class="item"> 37 <div class="percentage"> 38 <div class="fixed"></div> 39 </div> 40 </div> 41 </div>