grid-gap-001-ref.html (1676B)
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 definite grid-gap in both axes</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:24px/1 monospace; padding:0; margin:0; 13 } 14 15 .wrapper { 16 display: inline-grid; 17 gap: 20px 10px; 18 grid-template-columns: repeat(4,auto); 19 grid-template-rows: repeat(3,auto); 20 background-color: #fff; 21 color: #444; 22 } 23 24 .box { 25 background-color: #444; 26 color: #fff; 27 padding: 20px; 28 } 29 30 .box .box { 31 background-color: #ccc; 32 color: #444; 33 } 34 35 .a { 36 grid-area: 1 / 1 / 2 / 3; 37 } 38 39 .b { 40 grid-area: 1/4; 41 } 42 43 .c { 44 grid-column: 1; 45 grid-row: 2 / 4; 46 margin-right: 10px; 47 } 48 49 .d { 50 grid-column: 2 / 5; 51 grid-row: 2 / 4; 52 display: grid; 53 row-gap: 100px; 54 column-gap: 10px; 55 grid: repeat(2,auto) / repeat(3,auto); 56 } 57 58 .e { 59 grid-area: 1/2; visibility:hidden; margin-left:15px; 60 } 61 .f { 62 grid-area: 1/3; visibility:hidden; margin-left:10px; 63 } 64 .g { 65 grid-area: 1/4; visibility:hidden; margin-left:15px; 66 } 67 </style> 68 </head> 69 <body> 70 71 <div class="wrapper"> 72 <div class="box a">A</div><div class="box e">E</div><div class="box f">F</div><div class="box g">G</div> 73 <div class="box b">B</div> 74 <div class="box c">C</div> 75 <div class="box d"> 76 <div class="box">E</div> 77 <div class="box">F</div> 78 <div class="box">G</div> 79 <div class="box h">H</div> 80 <div class="box i">I</div> 81 </div> 82 </div>