This template demonstrates all CSS Grid properties with examples. Each section covers a specific property, its possible values, and a visual example.
display: gridEstablishes a grid container, enabling grid layout for its children.
grid-template-columnsDefines the columns of the grid: e.g., 100px 1fr 2fr, repeat(3, 1fr), auto.
grid-template-rowsDefines the rows of the grid: e.g., 100px 1fr, auto, minmax(100px, 1fr).
grid-template-areasDefines a grid layout using named areas, e.g., "header header" "main sidebar".
grid-templateShorthand for grid-template-rows, grid-template-columns, and grid-template-areas.
grid-auto-columnsSets the size of implicitly created columns, e.g., 100px, 1fr.
grid-auto-rowsSets the size of implicitly created rows, e.g., 100px, minmax(100px, auto).
grid-auto-flowControls how auto-placed items are arranged: row, column, dense.
gapSets spacing between grid items: single value or row-gap column-gap.
justify-itemsAligns items along the inline (row) axis: start, end, center, stretch.
align-itemsAligns items along the block (column) axis: start, end, center, stretch.
place-itemsShorthand for align-items and justify-items, e.g., center center.
justify-contentAligns the grid along the inline axis: start, end, center, space-between, space-around, space-evenly, stretch.
align-contentAligns the grid along the block axis: start, end, center, space-between, space-around, space-evenly, stretch.
place-contentShorthand for align-content and justify-content, e.g., center center.
grid-column-gap (Deprecated)Sets spacing between columns (use column-gap or gap instead).
grid-row-gap (Deprecated)Sets spacing between rows (use row-gap or gap instead).
grid-gap (Deprecated)Shorthand for grid-row-gap and grid-column-gap (use gap instead).
grid-column-startSpecifies the starting column line for an item, e.g., 1, span 2.
grid-column-endSpecifies the ending column line for an item, e.g., 3, span 2.
grid-row-startSpecifies the starting row line for an item, e.g., 1, span 2.
grid-row-endSpecifies the ending row line for an item, e.g., 3, span 2.
grid-columnShorthand for grid-column-start and grid-column-end, e.g., 1 / 3.
grid-rowShorthand for grid-row-start and grid-row-end, e.g., 1 / 3.
grid-areaShorthand for grid-row-start, grid-column-start, grid-row-end, grid-column-end, or a named area, e.g., 1 / 1 / 3 / 3.
justify-selfAligns an item along the inline axis: start, end, center, stretch.
align-selfAligns an item along the block axis: start, end, center, stretch.
place-selfShorthand for align-self and justify-self, e.g., center center.