column-dense-packing-004-ref.html (850B)
1 <!DOCTYPE html> 2 <html> 3 <link rel="help" href="https://drafts.csswg.org/css-grid-3"> 4 <style> 5 .grid { 6 display: grid; 7 background: gray; 8 position: relative; 9 grid-template-columns: 30px 40px 50px 30px; 10 padding: 10px; 11 grid-auto-flow: dense; 12 } 13 </style> 14 <body> 15 <p>Ensure dense-packing only places items into gaps where the track size is the same as where the item would have been laid out WITHOUT dense packing.</p> 16 <div class="grid"> 17 <div style="background: lightskyblue; height: 40px; grid-column: 1" > 18 1 19 </div> 20 <div style="background: lightgreen; height: 40px; grid-column: 3"> 21 2 22 </div> 23 <div style="background: brown; height: 10px; grid-column: span 4;"> 24 3 25 </div> 26 <div style="background: red; height: 40px; width: 30px; grid-column: 4;"> 27 4 28 </div> 29 </div> 30 </body> 31 </html>