SystemTutor
About
Sign in
Loading course documentation…
SystemTutor

COURSES

  • Data Structures & Algorithms
  • CSS MasterclassNew course
  • System DesignNew course

PRACTICE

  • Algorithm practice
  • CSS practice

LEGAL

  • Privacy Policy
  • Terms of Service
  • About

© 2026 SystemTutor. All rights reserved.

Built with 🫶 by Shatlyk

Welcome to CSS
Grid FundamentalsGrid TracksGrid Placement and Layout DecisionsImplicit GridsFlexible GridsGrid AlignmentGrid or Flexbox Placing items on a grid
CSS Grid

Grid Placement and Layout Decisions

Read a grid item’s start and end lines and predict where automatically placed siblings can fit.

The grid container determines the tracks. A child can ask to occupy a particular part of that grid, leaving the browser to place the other children in the remaining cells. Start by finding the edges of the space the child needs.

Count the boundary lines

Read a three-column grid in horizontal, left-to-right text. The columns lie between lines 1 and 2, 2 and 3, and 3 and 4. For an item with grid-column set to 1 / 3, the first number is its starting edge and the second is its ending edge. It covers the first two columns, including the gap between them. The third column remains available.

span expresses how many tracks an item needs. A request to span two columns leaves the browser to find a suitable start if you do not supply one. An item that must reach a known boundary, such as a banner across the full explicit grid, is often easier to describe with edge lines. Line -1 identifies the last line of that explicit grid in the chosen axis.

Leave room for automatic placement

Suppose the first item starts at row 1, column 1 and covers two columns. With default row-wise placement and single-cell siblings, the next item can take the third column of row 1. Its following sibling starts row 2. As more siblings arrive, Grid can create additional rows.

Visual placement can move a card away from its source-order neighbors. Keep the HTML sequence meaningful when someone reads the content or tabs between its controls.

Key Takeaways

  • A start line and an end line identify the edges of a grid area.
  • Give a position to the items that need one. The rest can use the remaining cells.

Try it yourself

Try it yourself

Place a featured tile

HTML + CSS

Loading code editor…

Live preview

Updating…

Final output

No comparison yetChecks after 3s without edits
Loading your draft…

How is this lesson?

Previous lessonGrid TracksNext lessonImplicit Grids
Edit on GitHubReport on GitHub
On this page
%

On this page

Count the boundary linesLeave room for automatic placementKey TakeawaysTry it yourself