grid-gap-003-ref.html (1499B)
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>Reference: subgrid with border-bottom and percentage gap</title> 9 <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com"> 10 <style> 11 html,body { 12 color:black; background-color:white; font:12px/1 monospace; padding:0; margin:0; 13 } 14 15 .grid { 16 display: grid; 17 grid: 0 15px 15px 0 0 40px / repeat(5, auto); 18 place-content: start; 19 border: 1px solid; 20 } 21 22 .subgrid { 23 display: grid; 24 grid: repeat(4, auto) / auto auto; 25 gap: 3px 8px; 26 background: lightgrey; 27 grid-column: 2 / span 5; 28 grid-row: 2 / span 5; 29 background: grey; 30 width: 40px; 31 height: 30px; 32 } 33 34 .subgrid > * { background: lightgrey; } 35 36 x { 37 min-width:10px; 38 min-height:0px; 39 } 40 x:nth-child(2n+1) { background: silver; } 41 x:nth-child(2n+2) { background: magenta; } 42 x:nth-child(2n+3) { background: pink; } 43 x:nth-child(2n+4) { background: grey; } 44 45 e { display:block; width: 20px; height:15px; background:black; } 46 47 f { 48 grid-area: 4/2/span 1/span 5; 49 background: lightblue!important; 50 height: 40px; 51 } 52 </style> 53 </head> 54 <body> 55 56 <div class="grid"> 57 <x style="grid-row:1; height:0"></x><x style="grid-row:2"></x><x style="grid-row:3"></x><x style="grid-row:4"></x><x style="grid-row:5"></x><x style="grid-row:6"></x> 58 <f></f> 59 <div class="subgrid"> 60 <c><e></e></c> 61 <d><e></e></d> 62 <c><e></e></c> 63 <d><e></e></d> 64 </div> 65 </div> 66 67 </body> 68 </html>