CSS Master Code Examples: Chapter 5

Back to chapter demo list

A simple, explicit grid layout

The grid container, distinguished by a light gray background, is a block box with a grid formatting context. As a block box, it fills the width of its containers (the body element). We've explicitly defined three columns for this grid using grid-template-columns: 25rem 40rem 25rem and two rows using grid-template-rows: 25rem 15rem;. This is an example of an explicit grid.

Related specification: CSS Grid Layout Module Level 1.

Grid item A
Grid item B
Grid item C
Grid item D
Grid item E