Defining and using advanced grid templates
So far, we’ve looked at explicitly named grid areas defined with grid-template-areas
. We looked at how we can define header bars that span multiple columns, arrange items automatically or explicitly in these areas, and learned how to leverage grid areas to create standard layouts.
However, there’s more to grid areas. We can define cells that will always be empty, name grid areas by their grid lines, or even arrange nested child elements in parent grids using grid areas. First, we’ll look at always-empty grid cells.
Defining empty cells in grid area templates
Sometimes, we want grid cells always to stay empty. This is the case for layouts that use the entire width of the grid container for header and footer bars but not for the main content area.
Let’s look at the following HTML code:
<div class="container"> <header class="header"> ...