CSS 20 ๐ป grid-auto-columns, grid-auto-rows and grid-auto-flow properties
a - grid-auto-columns property
grid-auto-columns defines the default size for auto-placed columns in grid layout
It is useful when you want to specify a consistent width for all columns
This way you do not have to specify each column individually
It applies only to auto-placed grid items
not to items that are explicitly defined
values โ length(px, cm), percentage(%), fr, minmax, fit-content,
mix-content, max-content and auto
grid-auto-columns: 200px; โ defines the default column width to 200px;
b - grid-auto-rows property
grid-auto-rows defines the default size for auto-placed rows in grid layout
It is useful when you want to specify a consistent width for all rows
This way you do not have to specify each rows individually
It applies only to auto-placed grid items
not to items that are explicitly defined
values โ length(px, cm), percentage(%), fr, minmax, fit-content,
mix-content, max-content and auto
grid-auto-rows: 200px; โ defines the default column height to 50px;
c - grid-auto-flow property
grid-auto-flow specifies how auto-placed items are placed in the grid
It can have one or two values that specify row/column and grid density
values โ row, column, dense (if one values used)
row dense, column dense (if two values are used)
row โ ensures that auto-placed items are placed in a row-wise manner
column โ ensures that auto-placed items are placed in a column-wise manner
dense โ fills in the holes in the grid
if is not used row or columned , then row is the default, If is not used dense then it does not fill holes
grid-auto-flow: row dense; โ fill the container's size and minimize the number of rows used
20 – grid-auto-columns, grid-auto-rows and grid-auto-flow properties
<div class="grid-container">
<div class="cell">Auto-Placed Item 1 (200px)</div>
<div class="cell">Auto-Placed Item 2 (200px)</div>
<div class="cell">Item with different content</div>
</div>
<div class="grid-container-rows">
<div class="cell">Auto-Placed Item 1 (50px)</div>
<div class="cell">Auto-Placed Item 2 (50px)</div>
<div class="cell">Item with different content</div>
</div>
<div class="grid-container-flow">
<div class="cell">Item 1</div>
<div class="cell">Item 2</div>
<div class="cell">Item 3</div>
<div class="cell">Item 4</div>
<div class="cell">Item 5</div>
<div class="cell">Item 6</div>
</div>
.grid-container {
display: grid;
grid-template-rows: 50px auto 70px;
grid-auto-columns: 200px;
}
.cell {
border: 1px solid black;
padding: 10px;
}
.grid-container-rows {
display: grid;
grid-template-columns: 200px auto;
grid-auto-rows: 50px;
}
.grid-container-flow {
display: grid;
grid-template-rows: repeat(3, 50px);
grid-template-columns: repeat(2, 200px);
grid-auto-flow: row dense;
}
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!