CodesCompiler
🔍
HTMLCSSJavaScriptPythonSQLPHPSEOPostsBooksKids About Contact 🚀 Get Started Free

CSS - place-items Property

CSS - place-items Property

CSS place-items is a shorthand property used in CSS Grid Layout to set both the align-items and justify-items properties in a single declaration. It allows you to align and justify grid items within the grid container along both the block (column) and inline (row) axes simultaneously

This property is a shorthand for the following CSS properties:

  • align-items

align-items

  • justify-items

justify-items

Possible Values

  • A single align-items value aligns in both the block and inline directions.

A single align-items value aligns in both the block and inline directions.

  • An align-items value sets the block direction alignment, followed by justify-items , which specifies inline alignment.

An align-items value sets the block direction alignment, followed by justify-items , which specifies inline alignment.

Applies To

All elements.

Syntax

Keyword Values

CSS CODE
place-items: center;
place-items: normal start;

Positional Alignment

CSS CODE
place-items: center normal;
place-items: start legacy;
place-items: end normal;
place-items: self-start legacy;
place-items: self-end normal;
place-items: flex-start legacy;
place-items: flex-end normal;

Baseline Alignment

CSS CODE
place-items: baseline normal;
place-items: first baseline legacy;
place-items: last baseline normal;
place-items: stretch legacy;

CSS place-items - Placing Items in a Grid Container

The following example demonstrates the different behavior of the place-items property in the grid layout −

Preview

CSS place-items - Placing Items in a Flex Container

The following example demonstrates the different behavior of the place-items property in the flex layout −

Preview