grid-justify-content-003.html (3070B)
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: Testing 'justify-content' fallback values</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151214"> 10 <link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-justify-content"> 11 <link rel="match" href="grid-justify-content-003-ref.html"> 12 <style type="text/css"> 13 html,body { 14 color:black; background-color:white; font-size:16px; padding:0; margin:0; 15 } 16 17 .grid { 18 display: grid; 19 grid-auto-columns: minmax(1px,auto); 20 grid-template-rows: 0px 7px; 21 border: 2px solid black; 22 float: left; 23 margin-right: 20px; 24 } 25 26 .grid :last-child { background:grey; } 27 .grid :nth-child(2) { background:pink; } 28 29 x { background: lime; height:7px; } 30 31 </style> 32 </head> 33 <body> 34 35 <script> 36 document.body.style.display = "none"; 37 var justify = [ 38 "stretch", 39 // FIXME: When https://github.com/w3c/csswg-drafts/issues/1002 is implemented. 40 // "stretch end", 41 // "stretch center", 42 // "stretch safe end", 43 // "stretch unsafe end", 44 "safe start", 45 "safe end", 46 "safe center", 47 "unsafe start", 48 "unsafe end", 49 "unsafe center", 50 "space-between", 51 // FIXME: https://github.com/w3c/csswg-drafts/issues/1002 52 // "space-between end", 53 // "space-between start", 54 // "space-between safe end", 55 // "space-between unsafe end", 56 "space-around", 57 // FIXME: https://github.com/w3c/csswg-drafts/issues/1002 58 // "space-around center", 59 // "space-around right", 60 // "space-around safe right", 61 // "space-around left", 62 "space-evenly", 63 // FIXME: https://github.com/w3c/csswg-drafts/issues/1002 64 // "space-evenly flex-end", 65 // "space-evenly safe flex-end", 66 // "space-evenly unsafe flex-start", 67 // "space-evenly right", 68 ]; 69 var cols = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ]; 70 var widths = [ "0", "1", "2", "3", "4", "5", "6" ]; 71 for (var j = 0; j < justify.length; ++j) { 72 // document.body.appendChild(document.createTextNode(justify[j])); // for debugging 73 var chunk = document.createElement('div'); 74 chunk.setAttribute("style", "border:1px solid; padding:2px 10px; overflow:hidden"); 75 for (var c = 0; c < cols.length; ++c) { 76 for (var w = 0; w < widths.length; ++w) { 77 // set this to true if you want to see all tests 78 var run_test = widths[w] < cols[c] || cols[c] == 0 || cols[c] == 1; 79 if (run_test) { 80 var grid = document.createElement('div'); 81 grid.style.width = widths[w]+"px"; 82 grid.className = "grid"; 83 grid.style.justifyContent = justify[j]; 84 var span = document.createElement('span'); 85 span.style.gridColumn = "1 / span " + cols[c]; 86 grid.appendChild(span); 87 for (var x = 0; x < cols[c]; ++x) { 88 grid.appendChild(document.createElement('x')); 89 } 90 chunk.appendChild(grid); 91 } 92 } 93 } 94 document.body.appendChild(chunk); 95 } 96 document.body.style.display = ""; 97 </script> 98 99 </body> 100 </html>