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