CSS Grid placement, online

Six activities your students do on their own devices. See who's finished, and their scores.

CSS Grid placement in one minute

What students need to know

The negative coordinate index -1 matches against any terminal boundary lines dynamically. grid-area provides an all-inclusive placement method for row and column track indexes.

The slash operator parses grid boundary segments neatly, like 1 / 4. -1 references the reverse terminal boundary line, which is useful for full-bleed layouts.

Mistakes students make

  • Line 0 has invalid selector syntax. Remove the extra 'class' keyword.
  • Line 0 is incorrect because a colon cannot be placed between the class selector and the opening brace.
  • Line 1 is incorrect. There is no grid-column-start-end property; use the grid-column shorthand instead.
  • Line 1 is incorrect. The 'to' keyword is invalid; use a forward slash (/) to separate start and end lines.
PREVIOUS · MODULE 56CSS Grid container
YOU ARE HERE · MODULE 57CSS Grid placement
NEXT · MODULE 58Backgrounds

Discover other journeys with this module

What students will learn in this module

Every question in Module 57

Quick questions

  1. Which property positions a grid item horizontally between column lines?Agrid-columnBgrid-row
  2. What character separates the starting line from the ending line in shorthand placement?AForward slash ( / )BColon ( : )
  3. What line number can you use to target the very last line of an explicit grid layout?A0B-1
  4. Which syntax correctly makes a block stretch across exactly three tracks?Aexpand(3)Bspan 3
  5. In the grid-area shorthand, which value comes first in the sequence?Agrid-row-startBgrid-column-start

Key terms

Students type the meaning of:

  • grid-column

Match the pairs

.item {
  grid-column: 1 / 4;
}
Match it to what it does
.item {
  grid-row: 2 / span 2;
}
Match it to what it does
Stretches a layout block completely from the first column line to the last grid edge.Match it to what it does
Consolidates all row and column boundaries cleanly within a single instruction rule.Match it to what it does
.item {
  grid-column: 1, 3;
}
Match it to what it does
.item {
  grid-row: span(2);
}
Match it to what it does

Fill in the blanks

  1. .item-a {
      ___________: 1 / 3;
    }

    Hint: Type the shorthand property that defines column placement lines

  2. .item-b {
      ________: 2 / 5;
    }

    Hint: Type the shorthand property that defines row placement lines

  3. .sidebar {
      grid-column: 1 / ____ 2;
    }

    Hint: Type the keyword used to stretch an item across multiple tracks

  4. .header {
      _________: 1 / 1 / 2 / 5;
    }

    Hint: Type the mega-shorthand property setting rows and columns together

  5. .footer {
      grid-column: _ / -1;
    }

    Hint: Type the track line number to start at the first column edge

Spot the error

Question 1

A.item class {B  grid-column: 1 / 3;C  grid-row: 1 / 2;D}

Question 2

A.box: {B  grid-column: 1 / 3;C  grid-row: 2 / 4;D}

Question 3

A.panel {B  grid-column-start-end: 1 / 3;C  grid-row: 1 / 2;D}

Question 4

A.sidebar {B  grid-column: 1 to 4;C  grid-row: 2 / 3;D}

Question 5

A.main {B  grid-column: 1 / 4;C  grid-rows: 2 / 3;D}