grid-justify-content-002.html (2297B)
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 track distribution rounding errors</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-002-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: 1px solid blue; 22 } 23 .stretch { justify-content: stretch; } 24 /* I don't know how to make a reference for these so they are only included to 25 trigger possible assertions: */ 26 .space-between { justify-content: space-between; visibility:hidden; } 27 .space-around { justify-content: space-around; visibility:hidden; } 28 .space-evenly { justify-content: space-evenly; visibility:hidden; } 29 30 .grid :last-child, .grid :nth-child(2) { background:black; } 31 32 x { background: lime; height:7px; } 33 34 </style> 35 </head> 36 <body> 37 38 <script> 39 var justify = [ "stretch", "space-between", "space-around", "space-evenly" ]; 40 var cols = [ "151", "1" ]; 41 var widths = [ "151", "152", "153", "154", "155", "156", "157", "158", "159", 42 "160", "161", "301", "302", "303", "304", "305", "306", "307", 43 "308", "309", "310", "311" ]; 44 for (var c = 0; c < cols.length; ++c) { 45 var chunk = document.createElement('div'); 46 chunk.setAttribute("style", "float:left; margin:1px"); 47 for (var j = 0; j < justify.length; ++j) { 48 for (var w = 0; w < widths.length; ++w) { 49 var grid = document.createElement('div'); 50 grid.style.width = widths[w]+"px"; 51 grid.className = "grid " + justify[j]; 52 var span = document.createElement('span'); 53 span.style.gridColumn = "1 / span " + cols[c]; 54 grid.appendChild(span); 55 for (var x = 0; x < cols[c]; ++x) { 56 grid.appendChild(document.createElement('x')); 57 } 58 chunk.appendChild(grid); 59 } 60 } 61 document.body.appendChild(chunk); 62 } 63 document.body.style.display = ""; 64 </script> 65 66 </body> 67 </html>