Favorites

CSS <self-position> Data Type

<self-position>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <self-position> data type is a keyword that places a single item in its space: center, start, end, self-start, self-end, flex-start or flex-end.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <self-position> CSS data type represents the keywords that position a single item inside the space available to it, its alignment area, such as a grid cell or the cross axis of a flex line. It is used by align-self, justify-self and place-self on individual items, and by align-items, justify-items and place-items on the container to set a default for all items.

The keywords are center, start, end, self-start, self-end, flex-start and flex-end. start and end use the writing mode of the container, while self-start and self-end use the item's own writing mode, which only matters when they differ. flex-start and flex-end follow the flex direction and only make a difference in flex layout. The anchor-center keyword can also be used on anchor-positioned elements to centre them on their anchor.

A <self-position> can be preceded by safe or unsafe (see <overflow-position>). Other alignment values such as stretch, normal and the <baseline-position> keywords are accepted by the same properties but are not part of this type.

Examples:

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  place-items: center;          /* every item centred in its cell */
}

.grid .badge {
  justify-self: end;            /* this item moves to the end */
  align-self: start;
}

Interactive Demo

The dashed box is the grid cell.
Demo Code
HTML Code
<div class="demo-grid">
	<div class="demo-element"></div>
</div>
<small class="demo-note">The dashed box is the grid cell.</small>
CSS Code
.demo-grid {
	display: grid;
	grid-template: 130px / 220px;
	width: 220px;
	background: #e7ecff;
	outline: 2px dashed #4361ee;
}
.demo-note {
	display: block;
	margin: 6px 0 0;
	font-size: 12px;
	color: #666;
}
.demo-element {
	min-width: 60px;
	min-height: 40px;
	background: #f72585;
	place-self: center;
}

Syntax

<self-position> = center | start | end | self-start | self-end | flex-start | flex-end

Values

  • centerThe item is centred in its alignment area.
  • startThe item is aligned to the start edge of the alignment area, in the container's writing mode.
  • endThe item is aligned to the end edge of the alignment area, in the container's writing mode.
  • self-startThe item is aligned to the edge that is the start in its own writing mode.
  • self-endThe item is aligned to the edge that is the end in its own writing mode.
  • flex-startIn flex layout, aligns the item to the cross-start side of the flex line. Elsewhere it behaves like start.
  • flex-endIn flex layout, aligns the item to the cross-end side of the flex line. Elsewhere it behaves like end.

Example

<div class="wrap">
<h1>CSS &lt;self-position&gt; examples</h1>
<div class="card cells">
<div class="cell a"><span>start</span></div>
<div class="cell b"><span>center</span></div>
<div class="cell c"><span>end</span></div>
<div class="cell d"><span>start end</span></div>
<div class="cell e"><span>end start</span></div>
<div class="cell f"><span>center end</span></div>
</div>
<p class="note">Each label shows the place-self value of the blue item (align-self then justify-self).</p>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fb;
  color: #102a43;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  color: #486581;
  margin-top: 10px;
  word-break: break-word;
}

.note {
  font-size: 13px;
  color: #486581;
  margin-top: 14px;
}

/*  examples */
.cells {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 100px;
  gap: 8px;
}

.cell {
  display: grid;
  border-radius: 8px;
  background: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 11px;
}

.cell span {
  padding: 6px 8px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
}

.a span { place-self: start; }
.b span { place-self: center; }
.c span { place-self: end; }
.d span { place-self: start end; }
.e span { place-self: end start; }
.f span { place-self: center end; }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS self-position data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.