Grid by Example

Everything you need to learn CSS Grid Layout

Margin is honored on the subgrid

If you add margins to the subgrid then this is honored. In our example I have added 50px of margin to the subgrid. The first and last column tracks therefore each become smaller as they have the margin eating into their space. Everything still lines up with the parent tracks however.

Read the specification | View example as full page

See the Pen Grid by Example 2.8: padding is honored on the subgrid. by rachelandrew (@rachelandrew) on CodePen.