CSS propertyGrid

place-self

A shorthand that sets align-self and justify-self for a single item.

Initial value
auto
Inherited
No
Animatable
no
Applies to
grid items, flex items (vertical only), and absolutely positioned elements
JavaScript
element.style.placeSelf = "center"
On this page

Example

#
CSS
.tile {
  display: grid;
  grid-template-columns: 1fr;
}

.tile .badge {
  grid-area: 1 / 1;
  place-self: start end;
}
Preview

Definition and usage

#

The place-self property combines an item’s vertical alignment (align-self) and horizontal alignment (justify-self). You set it on a specific grid item to position it in its cell differently from the rest.

One value works on both axes, so place-self: center centers an item within its cell. You give two values in order: vertical, then horizontal.

In flex items only the vertical part works, because justify-self is ignored there.

Syntax

#
Syntax
place-self: <align-self> <justify-self>?;

Values

#
  • auto

    The item follows the container’s alignment and stretches.
  • center

    Item 2 is centered in its cell.
  • end

    Item 2 sits in the bottom-right corner of its cell.
  • start center

    At the top and centered horizontally.

Values in practice

#

auto

The item follows the container’s alignment and stretches.
.target { place-self: auto; }

center

Item 2 is centered in its cell.
.target { place-self: center; }

end

Item 2 sits in the bottom-right corner of its cell.
.target { place-self: end; }

start center

At the top and centered horizontally.
.target { place-self: start center; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Overlapping items in the same cell (grid-area: 1 / 1) with place-self is a convenient alternative to position: absolute.
  • The order of values: vertical first (align), then horizontal (justify).

Related entries

#

Spotted a mistake or missing an example? Write to us.