Skip to content
Justice Tech School

Auto Placement and Dense Packing

grid-auto-flow chooses how items fill the grid. dense fills gaps. grid-auto-rows sets the height of automatically created rows.

Example
<style>
.g { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 40px; grid-auto-flow: dense; gap: 6px } .g div { background: #1e293b } .w { grid-column: span 2; background: #b45309 !important }
</style>
<div class="g"><div></div><div class="w"></div><div></div><div></div></div>

Exercise

Fill gaps.

grid-auto-flow: ;

Quiz Test

What does dense do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.