Building a grid

Alignment

Grid alignment works on two levels: items inside their cells, and tracks inside the container.

Aligning items inside their cells #

In the Alignment section:

SettingDirectionOptions
justify-itemsHorizontalstart, end, center, stretch
align-itemsVerticalstart, end, center, stretch, baseline

With stretch (the default), items fill their area. With any other value, items shrink to their content, which you will see in the preview.

Aligning the tracks inside the container #

SettingDirectionOptions
justify-contentHorizontalstart, end, center, stretch, space-between, space-around, space-evenly
align-contentVerticalstart, end, center, stretch, space-between, space-around, space-evenly

These only have a visible effect when the tracks are smaller than the container, for example fixed px columns in a wide container, or rows in a container with a set height. With fr tracks there is no free space left to distribute.

Aligning a single item #

Select an item and use Justify self and Align self under Selected item. These override the grid's setting for that item only, and are written into its rule:

.main {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  align-self: start;
}

Not set #

Not set (or Inherit from grid for items) leaves the property out of the CSS, so the browser default applies. GridFlow only writes what you change.