grid-fragmentation-026.html (4546B)
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, forced row breaks, avoid-break grid</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-026-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 page-break-inside:avoid; 40 break-inside:avoid; 41 } 42 span { background:lime; border:1px solid black; } 43 x { display:block; height:20px; } 44 m { display:block; padding-top:10px; } 45 .break-before { page-break-before:always; break-before:always; } 46 .break-after { page-break-after:always; break-after:always; } 47 48 </style> 49 </head> 50 <body> 51 52 <div class="columns" style="height: 100px/*two rows would fit in 1st column*/"> 53 <div style="background:grey"><m></m> 54 <div class="grid"> 55 <span style="grid-row:span 2"><x></x></span> 56 <span style="height:35px; background:cyan"><x></x></span> 57 <span><x></x></span> 58 <span class="break-before" style="align-self:end; background:pink"><x></x></span> 59 <span style="grid-row:1"><x></x></span> 60 <span><x></x></span> 61 </div></div></div> 62 63 <div class="columns" style="height:30px"> 64 <div style="background:grey"><m></m> 65 <div class="grid break-before"> 66 </div></div></div> 67 68 <div class="columns" style="height: 60px/*everything would fit in 1st column*/"> 69 <div style="background:grey"><m></m> 70 <div class="grid"> 71 <span class="break-before"><x></x></span> 72 </div></div></div> 73 74 <div class="columns" style="height: 100px/*everything would fit in 1st column*/"> 75 <div style="background:grey"><m></m> 76 <div class="grid"> 77 <span style="grid-row:span 2"><x></x></span> 78 <span style="height:35px; background:cyan"><x></x></span> 79 <span class="break-before" style="align-self:end; background:pink"><x></x></span> 80 <span style="grid-row:1; height:35px"><x></x></span> 81 </div></div></div> 82 83 <div class="columns" style="height: 100px/*everything would fit in 1st column*/"> 84 <div style="background:grey"><m></m> 85 <div class="grid"> 86 <span style="grid-row:span 2"><x></x></span> 87 <span class="break-after" style="height:35px; background:cyan"><x></x></span> 88 <span style="align-self:end; background:pink"><x></x></span> 89 <span style="grid-row:1; height:35px"><x></x></span> 90 </div> 91 </div></div> 92 93 <div class="columns" style="height: 100px/*everything would fit in 1st column*/"> 94 <div style="background:grey"><m></m> 95 <div class="grid"> 96 <span style="grid-row:span 2"><x></x></span> 97 <span style="height:35px; background:cyan"><x></x></span> 98 <span style="align-self:end; background:pink"><x></x></span> 99 <span class="break-before" style="grid-row:1; height:35px"><x></x></span> 100 </div> 101 </div></div> 102 103 <div class="columns" style="height: 97px/*everything would fit in 1st column, except bottom border*/"> 104 <div style="background:grey"><m></m> 105 <div class="grid"> 106 <span style="grid-row:span 2"><x></x></span> 107 <span style="height:35px; background:cyan"><x></x></span> 108 <span style="align-self:end; background:pink"><x></x></span> 109 <span class="break-before" style="grid-row:1; height:35px"><x></x></span> 110 </div> 111 </div></div> 112 113 <div class="columns" style="height: 80px/*one row fits in 1st column, two in 2nd column, but forced break there*/"> 114 <div style="padding-top:30px; background:grey"> 115 <div class="grid"> 116 <span style="grid-row:3"><x></x></span> 117 <span class="break-after" style="grid-row:span 2; background:cyan"><x></x></span> 118 <span class="break-before" style="grid-row:2; align-self:end; background:pink"><x></x></span> 119 <span style="grid-row:1; height:35px"><x></x></span> 120 </div> 121 </div></div> 122 123 <div class="columns" style="height: 160px/*everything would fit in 1st column*/"> 124 <div style="padding-top:30px; background:grey"> 125 <div class="grid"> 126 <span class="break-after" style="grid-row: span 3"><x></x></span> 127 <span class="break-after" style="grid-row: span 2"><x></x></span> 128 </div> 129 </div></div> 130 131 </body> 132 </html>