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