thecodezone.
The Code Zone
Short steps, at your pace · Free lessons and practice · Member video walkthroughs
Save your next small win.

Checking your account…

07.02 · Layout with Grid / Learn · 8 guided steps

Place and span Grid items

Use line numbers, span and narrow-screen resets to place dashboard regions without changing their reading order.

Activity 2 of 6 in Layout with Grid

All courses

CSS Basics / 07.02

Place and span Grid items

Not started

Use line numbers, span and narrow-screen resets to place dashboard regions without changing their reading order.

More options

Your lesson progress

Read & explore: not startedGuided practice: not started

Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Rob spans a header over three columns and a sidebar across two rows.
Rob’s comic strip · Layout with Grid

OVERVIEW VIDEO · 2:58

Watch the overview.

Watch Rob explain Grid line numbers, column and row spans, and narrow-screen placement resets. Then try the explorer and build the study dashboard in the guided practice below.

LEARN WITH THE CODE ZONE

Unlock this video walkthrough

Written lessons and coding practice are free. Video walkthroughs are included with a paid Code Zone membership or an active free trial.

Have a Code Zone website account? Use your learning account’s email to get a six-digit sign-in code, or use your existing website password.

Need a website account? Paid Skool members and active trial members can use the email from their membership questions to request a sign-in code. No invite link or Skool password needed.

Close this window to keep practicing. After signing in, you’ll return to this lesson.

Lesson videos are included with an active Code Zone membership. The written lesson and practice are free.

Count lines rather than boxes

Three columns have four boundary lines. grid-column: 1 / 3 starts at line 1 and ends at line 3, covering two tracks. grid-row uses the same idea vertically.

grid-column: 1 / -1 covers the explicit columns from the first line to the last. 1 / span 3 starts at line 1 and crosses three tracks. Place those declarations on the child item.

Try a different start and span

Move A to a different column line, then change how many columns and rows it covers. The outlined board keeps three columns so you can compare the same boundaries.

Move A across three columns and let it span rows. The HTML order stays A, B, C, D.

styles.css

The changed declaration is highlighted. This demo is separate from your saved workshop code.

YOUR GRID PREVIEW

A
B
C
D

Explore CSS Grid

A heading across the grid and a tall sidebar

A heading across the grid and a tall sidebar
styles.csscss · example
.lead {
  grid-column: 1 / -1;
}

.menu {
  grid-column: 1 / 2;
  grid-row: 2 / 4;
}

Do not hide a confusing reading order

Visual placement does not rewrite the document or keyboard focus order. Keep the HTML meaningful. Avoid placing two regions in the same cells unless overlapping is intentional.

At a narrow breakpoint, reset old child line assignments as well as the parent columns. Otherwise a reference to line 4 can create unwanted implicit columns in a one-column design.

Your turn: build it in small steps

Write the code yourself, check each stage and carry your work forward. The supplied shell links index.html to styles.css. The preview updates as you type.

The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.

Start mini-lesson(opens in a new tab)

8 steps · Saved work · Instant feedback

Keep a reference nearby

You do not need to memorize every Grid value. Predict the result, try a change and use the documentation to check the property you need.

Ready to try it?

Practice in your browser and see your results.

Progress details

Have a question?

Ask the Code Zone community.

Ask a question in The Code Zone (opens in a new tab)

Continue learning

ONE STEP FORWARD

Use line numbers, span and narrow-screen resets to place dashboard regions without changing their reading order.