CSS Grid Layout: Layout using Named Grid Lines
CSS Grid Layout: Layout using Named Grid Lines
In previous guides we’ve looked at placing items by the lines created by defining grid tracks and also how to place items using named template areas. In this guide we are going to look at how these two things work together when we use named lines. Line naming is incredibly useful, but some of the more baffling looking grid syntax comes from this combination of names and track sizes. Once you work through some examples it should become clearer and easier to work with.
Naming lines when defining a grid
You can assign some or all of the lines in your grid a name when you define your grid with the grid-template-rows
and grid-template-columns
properties. To demonstrate I’ll use the simple layout created in the guide on line-based placement. This time I’ll create the grid using named lines.
When defini