grid-abspos-items-016.html (2919B)
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: abs pos static position (ancestor of grid container as abs.pos. CB)</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151243"> 10 <link rel="help" href="http://dev.w3.org/csswg/css-grid/#static-position"> 11 <link rel="match" href="grid-abspos-items-015-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 padding: 1px 3px 5px 7px; 21 grid-template: 25px 33px 7px / 30px 51px 5px; 22 margin-right: 4px; 23 height: 100px; 24 width: 92px; 25 } 26 .wrap { 27 position: relative; 28 float: left; 29 padding: 3px 5px 7px 9px; 30 border-style: solid; 31 border-width: 1px 3px 5px 7px; 32 border-block-start-color: blue; 33 border-inline-start-color: lime; 34 writing-mode: vertical-lr; direction:rtl; 35 } 36 37 abs1,abs2,abs3,abs4 { 38 grid-area: 2 / 2 / 3 / 3; 39 position: absolute; 40 /* This is the only difference with grid-abspos-items-015.html */ 41 display: inline list-item; 42 list-style-type: none; 43 } 44 abs1 { top:17px; bottom:2px; background:lime; } 45 abs2 { right:13px; left:3px; background:pink; } 46 abs3 { right:5px; left:11px; top:9px; background:cyan; } 47 abs4 { top:23px; bottom:1px; background:silver; } 48 abs1::before { content:"1";} 49 abs2::before { content:"2";} 50 abs3::before { content:"3";} 51 abs4::before { content:"4";} 52 53 x { 54 grid-area: 2 / 2 / 3 / 3; 55 } 56 y { 57 grid-area: 3 / 3; 58 display: block; 59 } 60 z { 61 grid-area: 1 / 3; 62 display: block; 63 } 64 65 .hl { writing-mode: horizontal-tb; direction:ltr; } 66 .hr { writing-mode: horizontal-tb; direction:rtl; } 67 .vl { writing-mode: vertical-lr; } 68 .vr { writing-mode: vertical-rl; } 69 .vlr { writing-mode: vertical-lr; direction:rtl; } 70 .vrl { writing-mode: vertical-rl; direction:ltr; } 71 72 </style> 73 </head> 74 <body> 75 76 <script> 77 document.body.style.display="none"; 78 var wm = [ "hl", "hr", "vl", "vr", "vlr", "vrl" ]; 79 for (var i = 0; i < wm.length; ++i) { 80 for (var j = 0; j < wm.length; ++j) { 81 var div = document.createElement("div"); 82 div.className = "grid " + wm[i]; 83 div.appendChild(document.createTextNode("A")); 84 div.appendChild(document.createElement("abs1")); 85 div.appendChild(document.createTextNode("BC")); 86 div.appendChild(y = document.createElement("y")); 87 y.appendChild(document.createElement("abs3")); 88 div.appendChild(z = document.createElement("z")); 89 z.appendChild(document.createElement("abs4")); 90 var wrap = document.createElement("div"); 91 wrap.className = "wrap "; 92 wrap.appendChild(div); 93 document.body.appendChild(wrap) 94 } 95 document.body.appendChild(document.createElement("separator")); 96 } 97 document.body.style.display=""; 98 </script> 99 100 101 </body> 102 </html>