line-names-001.html (1464B)
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: subgrid item using line names from outer grid</title> 9 <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com"> 10 <link rel="help" href="https://drafts.csswg.org/css-grid-2"> 11 <link rel="match" href="line-names-001-ref.html"> 12 <style> 13 html,body { 14 color:black; background-color:white; font:24px/1 monospace; padding:0; margin:0; 15 } 16 17 .grid { 18 display: grid; 19 grid: auto / [a] 50px 50px [a] 50px 50px [a]; 20 padding: 20px 10px; 21 } 22 23 .subgrid { 24 display: grid; 25 grid: 50px / subgrid; 26 grid-column: span 3; 27 } 28 29 x { background: grey; } 30 31 </style> 32 </head> 33 <body> 34 35 <div class="grid"> 36 <div class="subgrid"> 37 <x style="grid-column: span a / a -1"></x> 38 </div> 39 </div> 40 41 <script> 42 const expectedResults = [ 43 "subgrid [] [] [] []", 44 ]; 45 [...document.querySelectorAll('.subgrid')].forEach(function(subgrid, i) { 46 let actual = window.getComputedStyle(subgrid)['grid-template-columns']; 47 let expected = expectedResults[i]; 48 if (actual != expected) { 49 let err = "Unexpected getComputedStyle value for subgrid " + i + " with className '" + subgrid.className + "':" + 50 " Actual: \"" + actual + "\", Expected: \"" + expected + "\""; 51 document.body.appendChild(document.createTextNode(err)); 52 } 53 }); 54 </script> 55 56 </body> 57 </html>