grid-row-gap-004-ref.html (3690B)
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>Reference: 'grid-row-gap' sideways-rl</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1227099"> 10 <style type="text/css"> 11 html,body { 12 color:black; background-color:white; font-size:16px; padding:0; margin:0; 13 } 14 15 .grid { 16 display: grid; 17 grid-auto-flow: column; 18 grid-auto-rows: minmax(1px,auto); 19 grid-template-columns: 0px 7px; 20 border: 2px solid black; 21 float: left; 22 writing-mode: sideways-rl; 23 margin-right:16px 24 } 25 26 .grid :last-child { background:grey; } 27 .grid :nth-child(2) { background:pink; } 28 .grid .gap { background:transparent; } 29 30 x { background: lime; height:7px; } 31 </style> 32 </head> 33 <body> 34 35 <script> 36 document.body.style.display = "none"; 37 var align = [ 38 "start", 39 // "end", 40 // "center", 41 // "start", 42 // "end", 43 "start", 44 "start", 45 "start", 46 "start", 47 "end", 48 "center", 49 "safe start", 50 // "end", 51 // "start", 52 // "safe end", 53 "safe center", 54 // "center", 55 // "start", 56 // "safe end", 57 // "start", 58 "safe center", 59 // "end", 60 ]; 61 var rows = [ "0", "1", "2", "3", "8", "9" ]; 62 var heights = [ "auto", "0", "1", "5", "6" ]; 63 var gaps = [ "1", "2" ]; 64 for (var j = 0; j < align.length; ++j) { 65 // document.body.appendChild(document.createTextNode(align[j])); // for debugging 66 var chunk = document.createElement('div'); 67 chunk.setAttribute("style", "border:1px solid; padding:2px 10px; overflow:hidden; float:left;"); 68 for (var c = 0; c < rows.length; ++c) { 69 for (var w = 0; w < heights.length; ++w) { 70 // set this to true if you want to see all tests 71 var run_test = heights[w] == "auto" || heights[w] < rows[c] || rows[c] == 0 || rows[c] == 1; 72 if (run_test) { 73 for (var g = 0; g < gaps.length; ++g) { 74 var grid = document.createElement('div'); 75 grid.style.width = heights[w]+"px"; 76 grid.className = "grid"; 77 grid.style.alignContent = align[j]; 78 var span = document.createElement('span'); 79 grid.appendChild(span); 80 var numRows = parseInt(rows[c]); 81 var gapRows = numRows==0 ? 0 : (numRows-1); 82 numRows += gapRows*parseInt(gaps[g]); 83 span.style.gridRow = "1 / span " + numRows; 84 for (var x = 0; x < numRows; ++x) { 85 var item = document.createElement('x'); 86 if (x % (1+(parseInt(gaps[g]))) != 0) 87 item.className = "gap"; 88 grid.appendChild(item); 89 } 90 // if (j < 5) { // The stretch tests. 91 if (j < 1) { // The stretch test. 92 if (c == 1) 93 grid.style.background = 'pink' 94 } 95 // if (j == 6 && rows[c] == 1) { // The 'safe end' tests. 96 if (j == 2 && rows[c] == 1) { // The 'safe end' tests. 97 if (heights[w] != 0) grid.style.alignContent = 'end'; 98 } 99 // if (j == 7 && rows[c] == 1) { // The 'safe center' tests. 100 if (j == 3 && rows[c] == 1) { // The 'safe center' tests. 101 if (heights[w] != 0) grid.style.alignContent = 'center'; 102 } 103 // if (j > 15) { // The space-around and space-evenly tests. 104 if (j > 7) { // The space-around and space-evenly tests. 105 if (rows[c] == 1) { 106 if (heights[w] != 0) { 107 grid.style.alignContent = 'center'; 108 } 109 } 110 } 111 chunk.appendChild(grid); 112 } 113 } 114 } 115 } 116 document.body.appendChild(chunk); 117 } 118 document.body.style.display = ""; 119 </script> 120 121 </body> 122 </html>