grid-auto-min-sizing-transferred-size-002-ref.html (2201B)
1 <!DOCTYPE HTML> 2 <!-- 3 Any copyright is dedicated to the Public Domain. 4 https://creativecommons.org/publicdomain/zero/1.0/ 5 --> 6 <html><head> 7 <meta charset="utf-8"> 8 <title>Reference: Testing track 'auto' min-sizing function with 'min-width:auto' on an item with an intrinsic aspect ratio</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1218178"> 10 <style type="text/css"> 11 html,body { color:black; background-color:white; font:12px monospace; padding:0; margin:0; } 12 13 .grid { 14 display: grid; 15 float: left; 16 border: 1px solid; 17 align-items: start; 18 justify-items: start; 19 margin-bottom:1em; 20 } 21 22 .col { grid-template-columns:minmax(auto,0); grid-auto-rows:10px; } 23 .col img { min-height:0; } 24 25 br { clear:both; } 26 27 </style> 28 </head> 29 <body> 30 31 <script> 32 var coltest = [ 33 "height:30px; max-width:200%", "height:30px; width:200%", "height:30px; width:50%", 34 "width:50%", "max-width:50%", "height:30px", "height:200%; width:80px", "height:50%", 35 "height:50%; width:20px", "max-height:50%", "max-height:50%; max-width:6px", 36 "min-height:40%", "min-height:40%; max-width:30px" 37 ]; 38 var results = [ 39 "360px", "0px", "0px", "0px", "24px", "360px", "80px", "60px", "20px", "24px", 40 "6px", "48px", "30px" 41 ]; 42 var item_width = [ 43 "0px", "0px", "0px", "0px", "0px", "360px", "80px", "60px", "20px", "24px", 44 "6px", "48px", "30px" 45 ]; 46 47 var h3 = document.createElement('h3'); 48 h3.appendChild(document.createTextNode("grid-template-columns:minmax(auto,0.0001fr)")); 49 document.body.appendChild(h3); 50 for (var i = 0; i < coltest.length; ++i) { 51 var grid = document.createElement('div'); 52 grid.setAttribute("class","grid col"); 53 grid.setAttribute("style","grid-template-columns:minmax("+results[i]+",0)"); 54 var img = document.createElement('img'); 55 img.setAttribute("src","support/lime-24x2.png"); 56 img.setAttribute("style",coltest[i] + "; width:"+ item_width[i]); 57 grid.appendChild(img); 58 document.body.appendChild(document.createTextNode(`Test ${i+1}: 24x2.png -- ${coltest[i]}`)); 59 document.body.appendChild(document.createElement('br')); 60 document.body.appendChild(grid); 61 document.body.appendChild(document.createElement('br')); 62 } 63 </script> 64 65 </body> 66 </html>