grid-item-align-003.html (4263B)
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 with overflow</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-003-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 body { margin:40px; } 17 separator { clear:both; display:block; height:6px; } 18 19 .grid { 20 display: grid; 21 float: left; 22 position: relative; 23 border: 1px solid; 24 /* border-block-start: 2px solid blue; */ 25 border-block-start: 2px solid black; 26 grid-template: 3px 20px 2px / 1px 32px 3px; 27 margin-right: 20px; 28 margin-bottom: 20px; 29 } 30 31 span { 32 grid-area: 2 / 2; /* the center grid area */ 33 display: block; 34 width: 40px; 35 height: 30px; 36 background: grey; 37 border-block-start: 2px solid blue; 38 border-inline-start: 2px solid lime; 39 margin: 1px 1px 2px 2px; 40 justify-self: start; 41 } 42 43 abs1,abs2,abs3,abs4 { 44 position: absolute; 45 top:0;left:0;bottom:0;right:0; 46 background: lightgrey; 47 } 48 abs1 { grid-area: 1 / 1 / 2 / 4; } 49 abs2 { grid-area: 1 / 1 / 4 / 2; } 50 abs3 { grid-area: 1 / 3 / 4 / 4; } 51 abs4 { grid-area: 3 / 1 / 4 / 4; } 52 53 .hl { writing-mode: horizontal-tb; direction:ltr; } 54 .hr { writing-mode: horizontal-tb; direction:rtl; } 55 .vl { writing-mode: vertical-lr; } 56 .vr { writing-mode: vertical-rl; } 57 .vlr { writing-mode: vertical-lr; direction:rtl; } 58 .vrl { writing-mode: vertical-rl; direction:ltr; } 59 60 .astart { align-self:unsafe start; } 61 .aend { align-self:unsafe end; } 62 .aflexstart { align-self:unsafe flex-start; } 63 .aflexend { align-self:unsafe flex-end; } 64 .aselfstart { align-self:unsafe self-start; } 65 .aselfend { align-self:unsafe self-end; } 66 .acenter { align-self:unsafe center; } 67 .aleft { align-self:unsafe left; } 68 .aright { align-self:unsafe right; } 69 .astretch1 { align-self:unsafe stretch; } 70 .astretch2 { align-self:unsafe stretch; width:40px; height:auto; } 71 .astretch3 { align-self:unsafe stretch; height:auto; } 72 .astretch4 { align-self:unsafe stretch; width:auto; } 73 .astretch5 { align-self:unsafe stretch; width:auto; max-width:38px; } 74 .astretch6 { align-self:unsafe stretch; height:auto; max-height:30px; } 75 .astretch7 { align-self:unsafe stretch; width:auto; height:auto; max-width:38px; max-height:30px; } 76 .aauto { align-self:auto; } 77 78 .safe.astart { align-self:safe start; } 79 .safe.aend { align-self:safe end; } 80 .safe.aflexstart { align-self:safe flex-start; } 81 .safe.aflexend { align-self:safe flex-end; } 82 .safe.aselfstart { align-self:safe self-start; } 83 .safe.aselfend { align-self:safe self-end; } 84 .safe.acenter { align-self:safe center; } 85 .safe.aleft { align-self:safe left; } 86 .safe.aright { align-self:safe right; } 87 .safe.astretch1 { align-self:safe stretch; } 88 .safe.astretch2 { align-self:safe stretch; } 89 .safe.astretch3 { align-self:safe stretch; } 90 .safe.astretch4 { align-self:safe stretch; } 91 .safe.astretch5 { align-self:safe stretch; } 92 .safe.astretch6 { align-self:safe stretch; } 93 .safe.astretch7 { align-self:safe stretch; } 94 95 96 </style> 97 </head> 98 <body> 99 100 <script> 101 var gridwm = [ "hl" ]; 102 var wm = [ "hl", "vrl", "hl safe", "vrl safe" ]; 103 var test = [ "start", "end", "flexstart", "flexend", "center", "left", "right", 104 "stretch1", "stretch2", "stretch3", "stretch4", "stretch5", 105 "stretch6", "stretch7", "auto" ]; 106 for (var i = 0; i < gridwm.length; ++i) { 107 for (var j = 0; j < wm.length; ++j) { 108 for (var k = 0; k < test.length; ++k) { 109 var div = document.createElement("div"); 110 div.className = "grid " + gridwm[i]; 111 var span = document.createElement("span"); 112 span.className = wm[j] + " a" + test[k]; 113 div.appendChild(span); 114 div.appendChild(document.createElement("abs1")); 115 div.appendChild(document.createElement("abs2")); 116 div.appendChild(document.createElement("abs3")); 117 div.appendChild(document.createElement("abs4")); 118 119 document.body.appendChild(div) 120 } 121 document.body.appendChild(document.createElement("separator")); 122 } 123 } 124 </script> 125 126 127 </body> 128 </html>