grid-fragmentation-005-ref.html (4660B)
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: Fragmentation of height:auto grid, not top-of-page, forced breaks</title> 9 <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1144096"> 10 <style type="text/css"> 11 html,body { 12 color:black; background-color:white; font-size:16px; padding:0; margin:0; 13 } 14 body { overflow:hidden; } 15 16 .columns { 17 position:relative; 18 -ms-columns: 5; 19 -webkit-columns: 5; 20 columns: 5; 21 -ms-column-fill: auto; 22 -webkit-column-fill: auto; 23 column-fill: auto; 24 border: 2px solid salmon; 25 margin-bottom: 5px; 26 } 27 28 .grid { 29 display: grid; 30 grid-template-columns: 30px 30px 30px; 31 grid-auto-rows: 30px; 32 grid-gap: 12px; 33 border:5px solid; 34 } 35 span { background:lime; border:1px solid black; } 36 x { display:block; height:20px; } 37 38 .t { border-bottom-width:0; } 39 .b { border-top-width:0; } 40 .m { border-top-width:0; border-bottom-width:0; } 41 42 .br1 { height:1px; } 43 44 </style> 45 </head> 46 <body> 47 48 <div class="columns" style="height: 100px/*two rows would fit in 1st column*/"> 49 <div style="padding-top:10px; background:grey"> 50 <div class="grid t"> 51 <span><x></x></span> 52 <span class="t"><x></x></span> 53 <span class="t" style="background:cyan"><x></x></span> 54 </div> 55 <div style="height:40px;"></div> 56 <div class="grid b"> 57 <span class="b"><x></x></span> 58 <span class="b" style="grid-area:1/3; height:6px; background:cyan"><x></x></span> 59 <span style="grid-area:1/3; align-self:end; background:pink"><x></x></span> 60 <span style="grid-row:1"><x></x></span> 61 <span><x></x></span> 62 </div></div></div> 63 64 <div class="columns" style="height:30px"> 65 <div style="padding-top:10px; background:grey"> 66 <div class="grid break-before"> 67 </div></div></div> 68 69 <div class="columns" style="height: 60px/*everything would fit in 1st column*/"> 70 <div style="padding-top:10px; background:grey"> 71 <div style="height:40px;"></div> 72 <div class="grid"> 73 <span><x></x></span> 74 </div></div></div> 75 76 <div class="columns" style="height: 100px/*everything would fit in 1st column*/"> 77 <div style="padding-top:10px; background:grey"> 78 <div class="grid t"> 79 <span class="t"><x></x></span> 80 <span class="t"><x></x></span> 81 <span class="t" style="background:cyan"><x></x></span> 82 </div> 83 <div style="height:40px;"></div> 84 <div class="grid b"> 85 <span class="b" style="grid-area:1/1; height:6px"><x></x></span> 86 <span style="align-self:end; grid-area:1/1; background:pink"><x></x></span> 87 <span class="b"><x></x></span> 88 <span class="b" style="height:6px; background:cyan"><x></x></span> 89 </div></div></div> 90 91 <div class="columns" style="height: 100px/*everything would fit in 1st column*/"> 92 <div style="padding-top:10px; background:grey"> 93 <div class="grid t"> 94 <span class="t"><x></x></span> 95 <span class="t"><x></x></span> 96 <span class="t" style="background:cyan"><x></x></span> 97 </div> 98 <div style="height:40px;"></div> 99 <div class="grid b"> 100 <span class="b" style="grid-area:1/1; height:6px"><x></x></span> 101 <span style="align-self:end; grid-area:1/1; background:pink"><x></x></span> 102 <span class="b"><x></x></span> 103 <span class="b" style="height:6px; background:cyan"><x></x></span> 104 </div></div></div> 105 106 <div class="columns" style="height: 100px/*everything would fit in 1st column*/"> 107 <div style="padding-top:10px; background:grey"> 108 <div style="height:90px;"></div> 109 <div class="grid"> 110 <span style="height:35px"><x></x></span> 111 <span style="grid-row:span 2"><x></x></span> 112 <span style="height:35px; background:cyan"><x></x></span> 113 <span style="grid-area:2/1; align-self:end; background:pink"><x></x></span> 114 </div> 115 </div></div> 116 117 <div class="columns" style="height: 80px/*one row fits in 1st column, two in 2nd column, but forced break there*/"> 118 <div style="padding-top:30px; background:grey"> 119 <div class="grid t"> 120 <span class="t"><x></x></span> 121 <span class="t" style="background:cyan"><x></x></span> 122 </div> 123 <div class="grid m"> 124 <span class="b" style="grid-area:1/1; height:6px"><x></x></span> 125 <span class="b" style="background:cyan"><x></x></span> 126 <span style="grid-area:1/1; align-self:end; background:pink"><x></x></span> 127 </div> 128 <div style="height:50px"></div> 129 <div class="grid b"> 130 <span style=""><x></x></span> 131 </div> 132 </div></div> 133 134 <div class="columns" style="height: 160px/*everything would fit in 1st column*/"> 135 <div style="padding-top:30px; background:grey"> 136 <div class="grid t"> 137 <span class="t" style="grid-row: span 2"><x></x></span> 138 <span style="grid-row: span 2"><x></x></span> 139 </div> 140 <div style="height:53px"></div> 141 <div class="grid b"> 142 <span class="b"><x></x></span> 143 </div> 144 </div></div> 145 146 </body> 147 </html>