grid-auto-min-sizing-transferred-size-004-ref.html (2138B)
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-height: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 body { overflow:hidden; } 13 14 .grid { 15 display: grid; 16 float: left; 17 border: 1px solid; 18 align-items: start; 19 justify-items: start; 20 margin-bottom:1em; 21 } 22 23 .row { } 24 .row img { min-width:0; } 25 26 br { clear:both; } 27 28 </style> 29 </head> 30 <body> 31 32 <script> 33 var rowtest = [ 34 "width:50%; max-height:200%", "width:50%; height:200%", "width:4px; height:50%", 35 "height:50%", "max-height:200%", "max-height:50%", "max-width:50%", "width:50%; height:12px", 36 "min-width:80%; max-height:12px", "min-width:50%", "margin-left: 50px; width:50%" 37 ]; 38 var results = [ 39 "12px/2px", "12px/2px", "48px/4px", "24px/1px", "24px/2px", "24px/1px", "12px/2px", "12px/1px", "12px/1px", "24px/2px", "312px/52px" 40 ]; 41 var item_height = [ 42 "12px", "24px", "24px", "12px", "24px", "12px", "12px", "12px", "12px", "24px", "312px" 43 ]; 44 45 var h3 = document.createElement('h3'); 46 h3.appendChild(document.createTextNode("grid-template-rows:minmax(auto,0.0001fr)")); 47 document.body.appendChild(h3); 48 for (var i = 0; i < rowtest.length; ++i) { 49 var grid = document.createElement('div'); 50 grid.setAttribute("class","grid row"); 51 grid.setAttribute("style","grid:" + results[i]); 52 var img = document.createElement('img'); 53 img.setAttribute("src","support/lime-2x24.png"); 54 img.setAttribute("style",rowtest[i] + "; max-height:auto; height:"+ item_height[i]); 55 grid.appendChild(img); 56 document.body.appendChild(document.createTextNode(`Test ${i+1}: 2x24.png -- ${rowtest[i]}`)); 57 document.body.appendChild(document.createElement('br')); 58 document.body.appendChild(grid); 59 document.body.appendChild(document.createElement('br')); 60 } 61 </script> 62 63 </body> 64 </html>