flexbox-min-width-auto-004.html (2348B)
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-width:auto & 'overflow' interaction</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-width-auto-004-ref.html"> 13 <!-- 14 This testcase checks how "overflow-y" indirectly impacts the sizing 15 behavior of flex items with "min-width:auto" (the new initial value 16 for "min-width"), via its influence on "overflow-x". 17 18 In particular, the flex-item-specific "min-width:auto" behavior is 19 supposed to be disabled (e.g. we end up with min-width:0) when 20 "overflow-x" is non-"visible". Moreover, when "overflow-y" is set to a 21 scrolling value, it forces "overflow-x" to compute to a scrolling value 22 as well, as described at 23 http://www.w3.org/TR/css-overflow-3/#overflow-properties 24 So, "overflow-y" has an indirect effect (via "overflow-x") here. 25 --> 26 <style> 27 .flexbox { 28 display: flex; 29 width: 30px; /* Shrink flex items below min-width */ 30 margin-bottom: 2px; /* (Just for spacing things out, visually) */ 31 } 32 33 .flexbox > * { 34 /* Flex items have purple border: */ 35 border: 2px dotted purple; 36 } 37 38 .flexbox > * > * { 39 /* Flex items' contents are gray & fixed-size: */ 40 background: gray; 41 height: 40px; 42 width: 80px; 43 } 44 45 .yvisible { overflow-y: visible; } 46 .yhidden { overflow-y: hidden; } 47 .yscroll { overflow-y: scroll; } 48 .yauto { overflow-y: auto; } 49 </style> 50 </head> 51 <body> 52 <!-- min-width:auto should prevent shrinking below intrinsic width when 53 the flex item has "overflow-y: visible", but not for any other 54 overflow-y values (because of overflow-y's influence on overflow-x). 55 --> 56 <div class="flexbox"><div class="yvisible"><div></div></div></div> 57 <div class="flexbox"><div class="yhidden"><div></div></div></div> 58 <div class="flexbox"><div class="yscroll"><div></div></div></div> 59 <div class="flexbox"><div class="yauto"><div></div></div></div> 60 </body> 61 </html>