flexbox-sizing-vert-002.xhtml (1983B)
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!-- 3 Any copyright is dedicated to the Public Domain. 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --> 6 <!-- 7 This testcase checks how "min-width" and "max-width" affect the sizing 8 of vertical flex containers that have no explicit "width" property. 9 --> 10 <html xmlns="http://www.w3.org/1999/xhtml"> 11 <head> 12 <title>CSS Test: Testing sizing of an auto-sized vertical flex container with min-width and max-width constraints</title> 13 <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/> 14 <link rel="help" href="http://www.w3.org/TR/css-flexbox-1/#layout-algorithm"/> 15 <link rel="match" href="flexbox-sizing-vert-002-ref.xhtml"/> 16 <style> 17 div { height: 100px; } 18 div.flexbox { 19 float: left; 20 border: 1px dashed blue; 21 background: lightgreen; 22 font-size: 10px; 23 display: flex; 24 margin-right: 10px; 25 } 26 </style> 27 </head> 28 <body> 29 <!-- floated auto-width vertical flexbox should shrinkwrap its contents. --> 30 <div class="flexbox"> 31 <div>AB</div> 32 </div> 33 34 <!-- Adding a small min-size shouldn't affect that. --> 35 <div class="flexbox" style="min-width: 2px"> 36 <div>AB</div> 37 </div> 38 39 <!-- ...nor should a large max-size. --> 40 <div class="flexbox" style="max-width: 300px"> 41 <div>AB</div> 42 </div> 43 44 <!-- OK. Now, if we set a minimum size that's larger than the shrinkwrap 45 size, we should jump up to that size.--> 46 <div class="flexbox" style="min-width: 30px"> 47 <div>AB</div> 48 </div> 49 50 <!-- If we set a maximum size that's smaller than the shrinkwrap size, 51 we should max out at that size.--> 52 <div class="flexbox" style="max-width: 3px"> 53 <div>AB</div> 54 </div> 55 56 <!-- But if we add a min-size, it beats the max-size. --> 57 <div class="flexbox" style="min-width: 30px; max-width: 5px"> 58 <div>AB</div> 59 </div> 60 61 </body> 62 </html>