CSS place-items property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxFully supports
Internet ExplorerFully supports
EdgeFully supports
OperaFully supports
Description
CSS place-items property controls the alignment of the child items vertically and horizontally. It is a shorthand property of align-items and justify-items.
We are using a grid container as an example.
Syntax
place-items : align-items justify-items
Property values
align-items
normalDefault
-
It stretches out the child elements so as to fill the height of the container completely.
- Try it
align-items: normal; baseline
-
It aligns multiple objects (elements) on same baseline such as cells within a row.
- Try it
align-items: baseline; stretch
-
It stretches all of the objects (elements) in such a way that they occupy the full height of the container.
- Try it
align-items: stretch; flex-start
-
flex-start aligns the content at the start of flex container.
- Try it
align-items: flex-start;
justify-items
autoDefault
-
It stretches out the element vertically to fill the width of container completely.
- Try it
justify-items: auto; stretch
-
It stretches the element so as fill the width of container completely.
- Try it
justify-items: stretch; flex-start
-
flex-start aligns the current element at the start of flex container.
- Try it
justify-items: flex-start; flex-end
-
flex-end aligns the current element at the end of the flex container.
- Try it
justify-items: flex-end;
Applicable to
It applies to all elements