grid-abspos-items-015.html (2852B)
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,abs3,abs4 { 38 grid-area: 2 / 2 / 3 / 3; 39 position: absolute; 40 display: block; /* Avoid bug 1769072 */ 41 } 42 43 /* Specify width or provide enough constraint to avoid bug 1769102 */ 44 abs1 { width:20px; top:17px; bottom:2px; background:lime; } 45 abs3 { right:5px; left:11px; top:9px; background:cyan; } 46 abs4 { width:20px; top:23px; bottom:1px; background:silver; } 47 abs1::before { content:"1";} 48 abs3::before { content:"3";} 49 abs4::before { content:"4";} 50 51 x { 52 grid-area: 2 / 2 / 3 / 3; 53 } 54 y { 55 grid-area: 3 / 3; 56 display: block; 57 } 58 z { 59 grid-area: 1 / 3; 60 display: block; 61 } 62 63 .hl { writing-mode: horizontal-tb; direction:ltr; } 64 .hr { writing-mode: horizontal-tb; direction:rtl; } 65 .vl { writing-mode: vertical-lr; } 66 .vr { writing-mode: vertical-rl; } 67 .vlr { writing-mode: vertical-lr; direction:rtl; } 68 .vrl { writing-mode: vertical-rl; direction:ltr; } 69 70 </style> 71 </head> 72 <body> 73 74 <script> 75 document.body.style.display="none"; 76 var wm = [ "hl", "hr", "vl", "vr", "vlr", "vrl" ]; 77 for (var i = 0; i < wm.length; ++i) { 78 for (var j = 0; j < wm.length; ++j) { 79 var div = document.createElement("div"); 80 div.className = "grid " + wm[i]; 81 div.appendChild(document.createTextNode("A")); 82 div.appendChild(document.createElement("abs1")); 83 div.appendChild(document.createTextNode("BC")); 84 div.appendChild(y = document.createElement("y")); 85 y.appendChild(document.createElement("abs3")); 86 div.appendChild(z = document.createElement("z")); 87 z.appendChild(document.createElement("abs4")); 88 var wrap = document.createElement("div"); 89 wrap.className = "wrap "; 90 wrap.appendChild(div); 91 document.body.appendChild(wrap) 92 } 93 document.body.appendChild(document.createElement("separator")); 94 } 95 document.body.style.display=""; 96 </script> 97 98 99 </body> 100 </html>