Named lines

Grid lines can be named so positioning is easier to read than with numbers and does not depend on the number of columns.
  • Names are written in square brackets inside grid-template-columns or grid-template-rows.
  • A single line can have several names, separated by spaces.
  • If you use the -start and -end suffixes, the browser creates an implicit area with that name, usable in grid-area.

Example

The grid defines the sidebar, main and full lines. Select a grid-column value to place the element with the item class using those names.

Select grid-column:
ResultLive
html
css