grid-item-intrinsic-ratio-normal-001.html (4130B)
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 no 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 grid-template-columns: repeat(7, min-content); 18 grid-auto-rows: min-content; 19 grid-column-gap: 10px; 20 } 21 22 img { min-width:0; min-height:0; } 23 24 x { width:32px; height:2px; background:cyan; } 25 .w24 > x { width:24px; } 26 .w8 > x { width:8px; } 27 .w4 > x { width:4px; } 28 29 </style> 30 </head> 31 <body> 32 33 <div class="grid"> 34 <div style="height:24px; width:2px; background:cyan; grid-row:1"></div> 35 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 36 <div style="height:24px; grid-row:3"></div> 37 <x style="grid-row:4"></x> 38 </div> 39 40 <br> 41 42 <div class="grid w24"> 43 <div style="height:32px; width:2px; background:cyan; grid-row:1"></div> 44 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 45 <div style="height:32px; grid-row:3"></div> 46 <x style="grid-row:4"></x> 47 </div> 48 49 <br> 50 51 <div class="grid w4" style="grid:8px 10px 8px / repeat(7, 4px); grid-column-gap:32px; "> 52 <div style="height:8px; width:2px; background:cyan; grid-row:1"></div> 53 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 54 <div style="height:8px; grid-row:3"></div> 55 <x style="grid-row:4"></x> 56 </div> 57 58 <br> 59 60 <div class="grid w4" style="grid-template-columns:repeat(7, 4px); grid-column-gap:32px; "> 61 <div style="height:32px; width:2px; background:cyan; grid-row:1"></div> 62 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 63 <div style="height:32px; grid-row:3"></div> 64 <x style="grid-row:4"></x> 65 </div> 66 67 <br> 68 69 <div class="grid w8" style="grid:repeat(3, 4px) / repeat(7, 8px); grid-gap:8px; "> 70 <div style="height:4px; width:2px; background:cyan; grid-row:1"></div> 71 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 72 <div style="height:4px; grid-row:3"></div> 73 <x style="grid-row:4"></x> 74 </div> 75 76 <br> 77 78 <div class="grid" style="grid-template-rows:repeat(3, 8px); grid-gap:16px; "> 79 <div style="height:4px; width:2px; background:cyan; grid-row:1"></div> 80 <div style="height:10px; grid-row:2; grid-column: span 7"></div> 81 <div style="height:4px; grid-row:3"></div> 82 <x style="grid-row:4"></x> 83 </div> 84 85 <br> 86 87 <script> 88 var url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAEElEQVQoz2NgGAWjYBTAAAADEAABaJFtwwAAAABJRU5ErkJggg%3D%3D"; 89 var grids = document.querySelectorAll('.grid'); 90 var js = [ "normal", "start", "center", "stretch" ]; 91 var as = [ "normal", "start", "center", "stretch" ]; 92 for (var i = 0; i < grids.length; ++i) { 93 for (var j = 0; j < js.length; j++) { 94 for (var a = 0; a < as.length; a++) { 95 if (as[a] != "normal" && as[a] != "stretch" && 96 js[j] != "normal" && js[j] != "stretch") { 97 continue; 98 } 99 var img = document.createElement('img'); 100 img.style.alignSelf = as[a]; 101 img.style.justifySelf = js[j]; 102 img.src = url; 103 img.setAttribute('title', as[a] + ' / ' + js[j]); 104 grids[i].appendChild(img); 105 } 106 } 107 for (var j = 0; j < js.length; j++) { 108 for (var a = 0; a < as.length; a++) { 109 if (as[a] != "normal" && as[a] != "stretch" && 110 js[j] != "normal" && js[j] != "stretch") { 111 continue; 112 } 113 var x = document.createElement('x'); 114 grids[i].appendChild(x); 115 } 116 } 117 } 118 </script> 119 120 <!-- For generating image size results in -ref file 121 <script> 122 document.body.clientHeight; 123 var imgs = document.querySelectorAll('img'); 124 var s = ' [\n'; 125 for (var i = 0; i < imgs.length; ++i) { 126 s += " ['"+ imgs[i].width + "px', '" + imgs[i].height + "px'],\n"; 127 } 128 s += ']'; 129 console.log(s) 130 </script> 131 --> 132 133 </body> 134 </html>