min-content-min-width-000.html (1458B)
1 <!DOCTYPE html> 2 <title>min-width: min-content with fixed-width children</title> 3 <link rel="help" href="https://www.w3.org/TR/css-sizing-3/#sizing-values"> 4 <link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic-contribution"> 5 <link rel="author" title="Ojan Vafai" href="mailto:ojan@chromium.org"> 6 <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"> 7 8 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 9 10 <style> 11 /* Reduce the heights if you want to add more variants. Don't go less than 2px per stripe. */ 12 13 .screen { 14 width: 100px; 15 height: 50px; 16 background: red; 17 } 18 19 .container { 20 min-width: min-content; 21 width: 50px; 22 height: 25px; 23 background: url(../support/1x1-red.png) repeat-x green; 24 } 25 .child { 26 width: 100px; 27 height: 10px; 28 background: green; 29 color: transparent; 30 } 31 32 .inline-block .child { 33 display: inline-block; 34 } 35 </style> 36 37 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 38 39 <div class="screen inline-block"> 40 <div class=container> 41 <div class=child>x</div> 42 </div> 43 <div class=container> 44 <div class=child>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div> 45 </div> 46 </div> 47 48 <div class="screen block"> 49 <div class=container> 50 <div class=child>x</div> 51 </div> 52 <div class=container> 53 <div class=child>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div> 54 </div> 55 </div>