grid-item-align-001.html (3424B)
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: align-self (part 1 of 2)</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151213"> 10 <link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-align-self"> 11 <link rel="match" href="grid-item-align-001-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-block-start: 2px solid blue; 24 grid-template: 3px 20px 2px / 1px 32px 3px; 25 margin-right: 4px; 26 } 27 28 span { 29 grid-area: 2 / 2; /* the center 32 x 20 pixel area */ 30 display: block; 31 width: 13px; 32 height: 9px; 33 background: grey; 34 border-block-start: 2px solid blue; 35 border-inline-start: 2px solid lime; 36 margin: 1px 1px 2px 2px; 37 justify-self: start; 38 } 39 40 abs1,abs2,abs3,abs4 { 41 position: absolute; 42 top:0;left:0;bottom:0;right:0; 43 background: lightgrey; 44 } 45 abs1 { grid-area: 1 / 1 / 2 / 4; } 46 abs2 { grid-area: 1 / 1 / 4 / 2; } 47 abs3 { grid-area: 1 / 3 / 4 / 4; } 48 abs4 { grid-area: 3 / 1 / 4 / 4; } 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 .astart { align-self:start; } 58 .aend { align-self:end; } 59 .aflexstart { align-self:flex-start; } 60 .aflexend { align-self:flex-end; } 61 .aselfstart { align-self:self-start; } 62 .aselfend { align-self:self-end; } 63 .acenter { align-self:center; } 64 .aleft { align-self:left; } 65 .aright { align-self:right; } 66 .astretch1 { align-self:stretch; } 67 .astretch2 { align-self:stretch; width:13px; height:auto; } 68 .astretch3 { align-self:stretch; height:auto; } 69 .astretch4 { align-self:stretch; width:auto; } 70 .astretch5 { align-self:stretch; width:auto; max-width:13px; } 71 .astretch6 { align-self:stretch; height:auto; max-height:9px; } 72 .astretch7 { align-self:stretch; width:auto; height:auto; max-width:13px; max-height:9px; } 73 .aauto { align-self:auto; } 74 75 </style> 76 </head> 77 <body> 78 79 <script> 80 var gridwm = [ "hl", "hr", "vl" ]; // grid-item-align-002.html tests vr/vlr/vrl 81 var wm = [ "hl", "hr", "vl", "vr", "vlr", "vrl" ]; 82 var test = [ "start", "end", "flexstart", "flexend", "center", "left", "right", 83 "stretch1", "stretch2", "stretch3", "stretch4", "stretch5", 84 "stretch6", "stretch7", "auto" ]; 85 for (var i = 0; i < gridwm.length; ++i) { 86 for (var j = 0; j < wm.length; ++j) { 87 for (var k = 0; k < test.length; ++k) { 88 var div = document.createElement("div"); 89 div.className = "grid " + gridwm[i]; 90 var span = document.createElement("span"); 91 span.className = wm[j] + " a" + test[k]; 92 div.appendChild(span); 93 div.appendChild(document.createElement("abs1")); 94 div.appendChild(document.createElement("abs2")); 95 div.appendChild(document.createElement("abs3")); 96 div.appendChild(document.createElement("abs4")); 97 98 document.body.appendChild(div) 99 } 100 document.body.appendChild(document.createElement("separator")); 101 } 102 } 103 </script> 104 105 106 </body> 107 </html>