Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. align-self

align-self

Specifies the cross-axis alignment for individual flex items. Can override the container's 'align-items' value.

Sample Code

/* Follow the container's align-items (default) */
.item { align-self: auto;}

/* Center this item only */
.item-center { align-self: center;}

/* Align this item to the bottom only */
.item-end { align-self: flex-end;}

/* Stretch this item only */
.item-stretch { align-self: stretch;}

Available Values

ValueDescription
autoコンテナの『align-items』のValueを使います。初期Valueです。
flex-startAligns the item to the start of the cross axis.
flex-endAligns the item to the end of the cross axis.
centerCenters the item along the cross axis.
baselineAligns the item to the text baseline within the item.
stretchStretches the item to fill the cross axis.

Specification

PropertyDetails
初期Valueauto
Applies toFlex items
InheritedNo
AnimationNot animatable (discrete)

Browser Support

Chrome Chrome
29 +
28
27
26
25
24
23
22
21
↑ Requires prefix '-webkit-'
20 and earlier ×
Firefox Firefox
20 +
19 and earlier ×
Safari Safari
9 +
8
7
↑ Requires prefix '-webkit-'
6 and earlier ×
Edge Edge
12 +
Supported in all versions.
IE IE
11
10
9 ×
8 ×
7 ×
6 ×
Opera Opera
12.1 +
11 and earlier ×
iOS Safari iOS Safari
9 +
8
7
↑ Requires prefix '-webkit-'
6 and earlier ×
Android Android Browser
4.4 +
3 and earlier ×
Chrome Android Chrome Android
Latest
Same support as desktop version
Firefox Android Firefox Android
Latest
Same support as desktop version

* Version information is based on MDN / Can I Use .

Description

『align-self』はFlex itemsに指定するPropertyで、コンテナに設定された『align-items』のValueをそのアイテムだけ上書きできます。「全体は上揃えだけど、このアイテムだけ中央に配置したい」といった場合に使います。

Relationship with align-items

align-items: flex-start (all aligned to top) A (top-aligned) B (centered) align-self: center C (bottom-aligned) align-self: flex-end

『align-items』はコンテナに指定して全アイテムの揃え方を一括で決めるPropertyです。『align-self』はアイテムに指定して個別に上書きするPropertyです。『align-self: auto』(初期Value)の場合は、コンテナの『align-items』のValueがそのまま適用されます。

.container {
    display: flex;
    align-items: flex-start;  /* All items align to top */
    height: 200px;
}
.item-a { /* align-self: auto -> flex-start is applied */ }
.item-b { align-self: center;}    /* Only this item is centered */
.item-c { align-self: flex-end;}  /* Only this item aligns to bottom */

Pattern: Pin Footer to Bottom

flex-direction: column Card body flex: 1 Footer (pinned to bottom) ← align-self: flex-end

/* Pin only the footer to the bottom within a card */
.card {
    display: flex;
    flex-direction: column;
    height: 300px;
}
.card-body { flex: 1;}
.card-footer {
    align-self: flex-end;  /* Place at the end of the cross axis (horizontal) */
}

Related Properties

PropertyDescription
align-itemsコンテナ内の全アイテムの交差軸方向の揃え方を一括で指定します。『align-self』はこのValueを個別に上書きします。
justify-content主軸方向の配置を制御します。個々のアイテムの主軸方向の配置を個別に変更するPropertyは標準にはありません(『margin: auto;』で代用可能)。

If you find any errors or copyright issues, please .