grid-justify-content-001-ref.html (2874B)
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: justify-content</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151214"> 10 <style type="text/css"> 11 html,body { 12 color:black; background-color:white; font-size:16px; padding:0; margin:0; 13 } 14 separator { clear:both; display:block; height:6px; } 15 16 .grid { 17 display: grid; 18 float: left; 19 position: relative; 20 border: 1px solid; 21 border-block-start: 2px solid blue; 22 grid-template: 3px 5px 7px / 11px 7px 5px; 23 padding: 1px 1px 3px 2px; 24 margin-right: 4px; 25 width: 40px; 26 height: 40px; 27 } 28 29 item1,item2,item3 { 30 display: block; 31 position: relative; 32 background: grey; 33 align-self: stretch; 34 justify-self: stretch; 35 } 36 37 item1 { grid-area: 1 / 1; } 38 item2 { grid-area: 2 / 2; } 39 item3 { grid-area: 3 / 3; } 40 41 .hl { writing-mode: horizontal-tb; direction:ltr; } 42 .hr { writing-mode: horizontal-tb; direction:rtl; } 43 .vl { writing-mode: vertical-lr; } 44 .vr { writing-mode: vertical-rl; } 45 .vlr { writing-mode: vertical-lr; direction:rtl; } 46 .vrl { writing-mode: vertical-rl; direction:ltr; } 47 48 .jend * , .jflexend * { inset-inline-start:17px; } 49 .jcenter * { inset-inline-start:8.5px; } 50 .hr.jleft * , .vlr.jleft * { inset-inline-start:17px; } 51 .hl.jright * , .vrl.jright * , .vl.jright * , .vr.jright * { inset-inline-start:17px; } 52 53 .jspace-between item2 { inset-inline-start:8.5px; } 54 .jspace-between item3 { inset-inline-start:17px; } 55 56 .jspace-around item1 { inset-inline-start:2.85px; } 57 .jspace-around item2 { inset-inline-start:8.5px; } 58 .jspace-around item3 { inset-inline-start:14.16px; } 59 60 .jspace-evenly item1 { inset-inline-start:4.25px; } 61 .jspace-evenly item2 { inset-inline-start:8.5px; } 62 .jspace-evenly item3 { inset-inline-start:12.75px; } 63 64 .jstretch2 { grid-template-columns:1fr 7px 5px; } 65 .jstretch3 { grid-template-columns:19.5px 15.5px 5px; } 66 .jstretch4 { grid-template-columns:16.66666px 12.66666px 10.66666px; } 67 68 </style> 69 </head> 70 <body> 71 72 <script> 73 var gridwm = [ "hl", "hr", "vl", "vr", "vlr", "vrl" ]; 74 var test = [ "start", "end", "flexstart", "flexend", "center", "left", "right", 75 "space-between", "space-around", "space-evenly", 76 "stretch1", "stretch2", "stretch3", "stretch4" ]; 77 for (var k = 0; k < test.length; ++k) { 78 for (var i = 0; i < gridwm.length; ++i) { 79 var div = document.createElement("div"); 80 div.className = "grid j" + test[k] + " " + gridwm[i]; 81 div.appendChild(document.createElement("item1")); 82 div.appendChild(document.createElement("item2")); 83 div.appendChild(document.createElement("item3")); 84 document.body.appendChild(div) 85 } 86 document.body.appendChild(document.createElement("separator")); 87 } 88 </script> 89 90 91 </body> 92 </html>