grid-item-intrinsic-ratio-normal-002.html (4416B)
1 <!DOCTYPE HTML> 2 <!-- 3 Any copyright is dedicated to the Public Domain. 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --> 6 <html><head> 7 <meta charset="utf-8"> 8 <title>CSS Grid Test: stretching intrinsic ratio item with 'normal' and/or 'stretch', with Automatic Minimum Size clamping</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1315383"> 10 <link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-justify-self-stretch"> 11 <link rel="match" href="grid-item-intrinsic-ratio-normal-001-ref.html"> 12 <style type="text/css"> 13 .grid { 14 display: inline-grid; 15 border: 1px solid; 16 margin: 5px; 17 } 18 19 x { width:32px; height:2px; background:cyan; } 20 .w24 > x { width:24px; } 21 .w8 > x { width:8px; } 22 .w4 > x { width:4px; } 23 24 </style> 25 </head> 26 <body> 27 28 <div class="grid" style="grid: minmax(auto, 24px) minmax(auto, 10px) minmax(auto, 24px) / repeat(7, minmax(auto, 32px)); grid-column-gap: 10px;"> 29 <div style="height:24px; width:2px; background:cyan; grid-row:1"></div> 30 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 31 <div style="height:24px; grid-row:3"></div> 32 <x style="grid-row:4"></x> 33 </div> 34 35 <br> 36 37 <div class="grid w24" style="grid: minmax(auto, 32px) minmax(auto, 10px) minmax(auto, 32px) / repeat(7, minmax(auto, 24px)); grid-column-gap: 10px;"> 38 <div style="height:32px; width:2px; background:cyan; grid-row:1"></div> 39 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 40 <div style="height:32px; grid-row:3"></div> 41 <x style="grid-row:4"></x> 42 </div> 43 44 <br> 45 46 <div class="grid w4" style="grid: minmax(auto, 8px) minmax(auto, 10px) minmax(auto, 8px) / repeat(7, minmax(auto, 4px)); grid-column-gap:32px; "> 47 <div style="height:8px; width:2px; background:cyan; grid-row:1"></div> 48 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 49 <div style="height:8px; grid-row:3"></div> 50 <x style="grid-row:4"></x> 51 </div> 52 53 <br> 54 55 <div class="grid w4" style="grid: minmax(auto, 32px) minmax(auto, 10px) minmax(auto, 32px) / repeat(7, minmax(auto, 4px)); grid-column-gap:32px; "> 56 <div style="height:32px; width:2px; background:cyan; grid-row:1"></div> 57 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 58 <div style="height:32px; grid-row:3"></div> 59 <x style="grid-row:4"></x> 60 </div> 61 62 <br> 63 64 <div class="grid w8" style="grid: repeat(3, minmax(auto, 4px)) / repeat(7, minmax(auto, 8px)); grid-gap:8px; "> 65 <div style="height:4px; width:2px; background:cyan; grid-row:1"></div> 66 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 67 <div style="height:4px; grid-row:3"></div> 68 <x style="grid-row:4"></x> 69 </div> 70 71 <br> 72 73 <div class="grid" style="grid: repeat(3, minmax(auto, 8px)) / repeat(7, minmax(auto, 32px)); grid-gap:16px; "> 74 <div style="height:4px; width:2px; background:cyan; grid-row:1"></div> 75 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 76 <div style="height:4px; grid-row:3"></div> 77 <x style="grid-row:4"></x> 78 </div> 79 80 <br> 81 82 <script> 83 var url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAEElEQVQoz2NgGAWjYBTAAAADEAABaJFtwwAAAABJRU5ErkJggg%3D%3D"; 84 var grids = document.querySelectorAll('.grid'); 85 var js = [ "normal", "start", "center", "stretch" ]; 86 var as = [ "normal", "start", "center", "stretch" ]; 87 for (var i = 0; i < grids.length; ++i) { 88 for (var j = 0; j < js.length; j++) { 89 for (var a = 0; a < as.length; a++) { 90 if (as[a] != "normal" && as[a] != "stretch" && 91 js[j] != "normal" && js[j] != "stretch") { 92 continue; 93 } 94 var img = document.createElement('img'); 95 img.style.alignSelf = as[a]; 96 img.style.justifySelf = js[j]; 97 img.src = url; 98 img.setAttribute('title', as[a] + ' / ' + js[j]); 99 grids[i].appendChild(img); 100 } 101 } 102 for (var j = 0; j < js.length; j++) { 103 for (var a = 0; a < as.length; a++) { 104 if (as[a] != "normal" && as[a] != "stretch" && 105 js[j] != "normal" && js[j] != "stretch") { 106 continue; 107 } 108 var x = document.createElement('x'); 109 grids[i].appendChild(x); 110 } 111 } 112 } 113 </script> 114 115 <!-- For generating image size results in -ref file 116 <script> 117 document.body.clientHeight; 118 var imgs = document.querySelectorAll('img'); 119 var s = ' [\n'; 120 for (var i = 0; i < imgs.length; ++i) { 121 s += " ['"+ imgs[i].width + "px', '" + imgs[i].height + "px'],\n"; 122 } 123 s += ']'; 124 console.log(s) 125 </script> 126 --> 127 128 </body> 129 </html>