0
0
CSSmarkup~10 mins

Grid item placement in CSS - Browser Rendering Trace

Choose your learning style9 modes available
Render Flow - Grid item placement
Parse CSS Grid container
Identify grid-template-columns and rows
Create grid lines and cells
Place grid items by default in order
Apply grid-column-start/end and grid-row-start/end
Calculate item size and position
Paint grid and items
Composite final layout
The browser reads the grid container styles, creates the grid structure, then places each grid item according to default flow or explicit placement properties before painting the final layout.
Render Steps - 4 Steps
Code Added:display: grid; grid-template-columns: 100px 100px 100px; grid-template-rows: 100px 100px;
Before
[ ]
[ ]
[ ]
After
[___][___][___]
[___][___][___]
The container becomes a grid with 3 columns and 2 rows, each cell 100px square, forming a visible grid structure.
🔧 Browser Action:Creates grid formatting context and calculates grid tracks
Code Sample
A 3-column by 2-row grid with three items placed explicitly in different grid cells and spanning columns or rows.
CSS
<div class="grid-container">
  <div class="item1">1</div>
  <div class="item2">2</div>
  <div class="item3">3</div>
</div>
CSS
.grid-container {
  display: grid;
  grid-template-columns: 100px 100px 100px;
  grid-template-rows: 100px 100px;
}
.item1 {
  grid-column-start: 2;
  grid-column-end: 4;
  grid-row-start: 1;
  grid-row-end: 2;
}
.item2 {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
}
.item3 {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}
Render Quiz - 3 Questions
Test your understanding
After applying step 2, where is item 1 placed in the grid?
ASpanning columns 1 to 2 on row 2
BIn column 1, spanning rows 1 to 3
CSpanning columns 2 to 4 on row 1
DIn column 3, row 2
Common Confusions - 2 Topics
Why does my grid item overlap others when I set grid-column-start and grid-column-end?
If you place an item to span columns or rows that other items also occupy, they visually overlap because grid allows overlapping unless you avoid it by careful placement or using auto-flow.
💡 Check grid line numbers and spans to avoid overlapping areas (see render_steps 2 and 3).
Why does my grid item not move when I change grid-column but not grid-row?
Grid placement requires both row and column positions; if you only change column, the row stays where it was, so the item moves horizontally but stays vertically fixed.
💡 Always specify both grid-row and grid-column for full control (see render_steps 2 and 3).
Property Reference
PropertyValue AppliedAxis/DirectionVisual EffectCommon Use
displaygridN/ACreates grid container and grid formatting contextDefines grid layout
grid-template-columns100px 100px 100pxHorizontalDefines 3 columns each 100px wideSets grid columns size
grid-template-rows100px 100pxVerticalDefines 2 rows each 100px tallSets grid rows size
grid-column-start2HorizontalStarts item at second vertical grid linePositions item horizontally
grid-column-end4HorizontalEnds item at fourth vertical grid line, spanning 2 columnsDefines horizontal span
grid-row-start1VerticalStarts item at first horizontal grid linePositions item vertically
grid-row-end2VerticalEnds item at second horizontal grid line, spanning 1 rowDefines vertical span
grid-column1 / 2HorizontalShorthand for start/end columnsQuick horizontal placement
grid-row1 / 3VerticalShorthand for start/end rows spanning 2 rowsQuick vertical placement
Concept Snapshot
Grid item placement uses grid-column-start/end and grid-row-start/end to position items. Grid lines define the boundaries for placement. Items can span multiple columns or rows. Default placement flows items in order if no explicit placement. Grid container must have display: grid to activate grid layout.