grid-item-justify-001-ref.html (3720B)
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-self (part 1 of 2)</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151213"> 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: block; 18 float: left; 19 position: relative; 20 border: 1px solid; 21 /* border-inline-start: 2px solid lime; */ 22 border-inline-start: 2px solid black; 23 inline-size: 36px; 24 block-size: 25px; 25 margin-right: 4px; 26 background: lightgrey; 27 } 28 29 wrap { 30 display: block; 31 position: relative; 32 inset-inline-start: 1px; 33 background: white; 34 block-size: 20px; 35 inline-size: 32px; 36 border-block-start: 3px solid lightgrey; 37 } 38 39 span { 40 display: block; 41 width: 13px; 42 height: 9px; 43 background: grey; 44 border-block-start: 2px solid blue; 45 border-inline-start: 2px solid lime; 46 margin: 1px 1px 2px 2px; 47 align-self: start; 48 } 49 50 .hl { writing-mode: horizontal-tb; direction:ltr; } 51 .hr { writing-mode: horizontal-tb; direction:rtl; } 52 .vl { writing-mode: vertical-lr; } 53 .vr { writing-mode: vertical-rl; } 54 .vlr { writing-mode: vertical-lr; direction:rtl; } 55 .vrl { writing-mode: vertical-rl; direction:ltr; } 56 57 .jstart { justify-self:start; } 58 .jend { justify-self:end; } 59 .jflexstart { justify-self:flex-start; } 60 .jflexend { justify-self:flex-end; } 61 .jselfstart { justify-self:self-start; } 62 .jselfend { justify-self:self-end; } 63 .jcenter { justify-self:center; } 64 .jleft { justify-self:left; } 65 .jright { justify-self:right; } 66 .jstretch1 { justify-self:stretch; } 67 .jstretch2 { justify-self:stretch; width:13px; height:auto; } 68 .jstretch3 { justify-self:stretch; height:auto; } 69 .jstretch4 { justify-self:stretch; width:auto; } 70 .jstretch5 { justify-self:stretch; width:auto; max-width:13px; } 71 .jstretch6 { justify-self:stretch; height:auto; max-height:9px; } 72 .jstretch7 { justify-self:stretch; width:auto; height:auto; max-width:13px; max-height:9px; } 73 .jauto { justify-self:auto; } 74 75 .hl .jend, .hl .jflexend, .hl .jright { margin-left: 16px; } 76 .hr .jend, .hr .jflexend { margin-right: 15px; } 77 .hl .jcenter { margin-left: 9px; } 78 .vl .jend, .vl .jflexend { margin-right:3px; } 79 .hr .jcenter { margin-right: 8px; } 80 .hr .jleft { margin-right: 15px; } 81 82 .hl .jstretch5, .hl .jstretch7, .hr .jstretch5, .hr .jstretch7 { width:14px; } 83 84 .jstretch4 { width:27px; } 85 .vl .jstretch4 { width:0px; } 86 87 .vl .jstretch2, .vl .jstretch3 { height:27px; } 88 .vl .jstretch6, .vl .jstretch7 { height:9px; } 89 .vl .jend, .vl .jflexend, .vl .jright { margin-top: 19px; } 90 .vl .jcenter { margin-top: 10px; } 91 92 </style> 93 </head> 94 <body> 95 96 <script> 97 var gridwm = [ "hl", "hr", "vl" ]; // grid-item-justify-002.html tests vr/vlr/vrl 98 var wm = [ "hl", "hr", "vl", "vr", "vlr", "vrl" ]; 99 var test = [ "start", "end", "flexstart", "flexend", "center", "left", "right", 100 "stretch1", "stretch2", "stretch3", "stretch4", "stretch5", 101 "stretch6", "stretch7", "auto" ]; 102 for (var i = 0; i < gridwm.length; ++i) { 103 for (var j = 0; j < wm.length; ++j) { 104 for (var k = 0; k < test.length; ++k) { 105 var div = document.createElement("div"); 106 div.className = "grid " + gridwm[i]; 107 var wrap = document.createElement("wrap"); 108 div.appendChild(wrap); 109 var span = document.createElement("span"); 110 span.className = wm[j] + " j" + test[k]; 111 wrap.appendChild(span); 112 document.body.appendChild(div) 113 } 114 document.body.appendChild(document.createElement("separator")); 115 } 116 } 117 </script> 118 119 120 </body> 121 </html>