CSS <content-position> Data Type
The <content-position> data type is a keyword that places the content of a container as a group: start, end, center, flex-start or flex-end.
Description
The <content-position> CSS data type represents the keywords that place the content of a container as a group, for example pushing all the items to the start, the end or the centre. It is used by justify-content, align-content and place-content in flex, grid and (for align-content) block layout.
The keywords are center, start, end, flex-start and flex-end. start and end refer to the start and end of the container's writing mode, so they adapt to right-to-left and vertical text. flex-start and flex-end follow the direction of a flex container, which matters when flex-direction is reversed; outside flex layout they behave like start and end.
A <content-position> can be preceded by an <overflow-position> keyword, safe or unsafe, which controls what happens when the content is larger than the container. To share space between items instead of moving them together, use a <content-distribution> keyword.
Examples:
.center-all {
display: grid;
place-content: center;
}
.actions {
display: flex;
justify-content: end;
}
/* Centre, but never hide overflowing content */
.list {
display: flex;
flex-direction: column;
justify-content: safe center;
}
Interactive Demo
Syntax
<content-position> = center | start | end | flex-start | flex-end
Values
- centerThe items are packed together in the centre of the container.
- startThe items are packed toward the start edge of the container in its writing mode.
- endThe items are packed toward the end edge of the container in its writing mode.
- flex-startThe items are packed toward the main-start (or cross-start) side of a flex container. Outside flex layout it behaves like start.
- flex-endThe items are packed toward the main-end (or cross-end) side of a flex container. Outside flex layout it behaves like end.
Example
Browser Support
The following information will show you the current browser support for the CSS content-position data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





