grid-lanes-subgrid-001d.html (1531B)
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: Grid Lanes layout with a subgrid (grid-lanes-subgrid-001d)</title> 9 <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com"> 10 <link rel="help" href="https://drafts.csswg.org/css-grid-3/#subgrids"> 11 <link rel="match" href="grid-lanes-subgrid-001d-ref.html"> 12 <style> 13 html,body { 14 color:black; background-color:white; font:16px/1 monospace; padding:0; margin:0; 15 } 16 17 grid { 18 display: inline-grid-lanes; 19 grid-lanes-direction: row; 20 grid-template-rows: 50px 80px 40px; 21 gap: 4px 2px; 22 padding: 1px 3px 5px 7px; 23 border: solid; 24 border-width: 3px 5px 1px 1px; 25 background: lightgrey content-box; 26 } 27 .rows { 28 grid-template-columns: 50px 80px 40px; 29 } 30 item { 31 background: grey; 32 width: 3ch; 33 position: relative; 34 } 35 item:nth-child(2n) { background:purple; width:auto; } 36 item:nth-child(1) { 37 border: solid; 38 border-width: 3px 13px 1px 1px; 39 margin: 7px 1px 5px 3px; 40 } 41 subgrid { 42 display: grid; 43 grid: subgrid / subgrid; 44 grid-row: 2 / span 2; 45 grid-gap: 8px 20px; 46 background: yellow; 47 } 48 .rows > subgrid { 49 grid-row: initial; 50 grid-column: 2 / span 2; 51 } 52 </style> 53 </head> 54 <body> 55 56 57 <grid class="rows"> 58 <item>1</item> 59 <item>2</item> 60 <item>3</item> 61 <subgrid style="grid:auto auto/subgrid"> 62 <item>4a</item> 63 <item>4b</item> 64 <item>4c</item> 65 </subgrid> 66 <item>5</item> 67 </grid> 68 69 </body></html>