CSS align-self Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Flexbox & Grid

What You’ll Learn

The align-self property lets you override cross-axis alignment for a single flex item or grid item. It is the item-level companion to align-items, useful when one box needs different positioning than its neighbors.

01

Item Override

Align one item differently.

02

Syntax

Apply it on the item itself.

03

auto Value

Inherits from align-items.

04

Flexbox

Pin or center one child.

05

CSS Grid

Align inside a grid area.

06

vs align-items

One item vs all items.

Definition and Usage

The align-self CSS property overrides the cross-axis alignment of an individual flex item or grid item. While align-items sets the default for every item in the container, align-self lets one item break that rule.

This is helpful for layouts like a row of cards where one action button sits at the bottom, or a toolbar where one icon needs vertical centering while the rest stay top-aligned.

💡
Beginner Tip

Set align-items on the container for the group, then use align-self only on the item that needs a different alignment.

📝 Syntax

Apply align-self to a flex item or grid item:

syntax.css
.item {
  align-self: value;
}

Basic Example

align-self.css
.container {
  display: flex;
  align-items: flex-start;
}

.item.special {
  align-self: flex-end;
}

Syntax Rules

  • Apply align-self to the item, not the flex or grid container.
  • The default value is auto, which uses the container’s align-items value.
  • Accepted keywords match align-items: stretch, center, flex-start, flex-end, and baseline.
  • Use it sparingly for exceptions; too many overrides can make layouts harder to maintain.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toFlex items and grid items
InheritedNo
AnimatableNo
Common useOverride alignment for one item in a row

Default Value

The initial value of align-self is auto. The item follows whatever alignment the container sets with align-items.

💎 Property Values

These keyword values override cross-axis alignment for a single item.

ValueExampleMeaning
autoalign-self: auto;Inherits alignment from the container’s align-items
flex-startalign-self: flex-start;Aligns the item to the start of the cross axis
flex-endalign-self: flex-end;Aligns the item to the end of the cross axis
centeralign-self: center;Centers the item on the cross axis
baselinealign-self: baseline;Aligns the item to its text baseline
stretchalign-self: stretch;Stretches the item to fill the flex line on the cross axis
auto

The highlighted item follows the container’s align-items: center rule like its siblings.

Flex container
Cross axis
center

Only item B is centered while A and C stay at the top because the container uses align-items: flex-start.

Flex container
Cross axis
stretch

Item B stretches to the full height of the flex line while the others keep their natural height.

Flex container
Cross axis

align-self vs align-items

PropertyApplied toBest for
align-itemsFlex or grid containerSetting the default alignment for all items
align-selfIndividual flex or grid itemOverriding alignment for one specific item

👀 Live Preview

Three boxes share a row. The middle box uses align-self: flex-end while the others stay at the top:

Examples Gallery

Try align-self to override one item with flex-end, center, stretch, and baseline.

📚 Item Overrides

These examples change alignment for one child while the container keeps a different align-items value.

Example 1 — Align One Item to the Bottom

Pin a single flex item to the end of the cross axis while the others stay at the start.

align-self-flex-end.html
<style>
  .container {
    display: flex;
    height: 200px;
    background: lightgray;
    align-items: flex-start;
  }
  .item {
    width: 50px;
    height: 50px;
    margin: 10px;
    background: coral;
  }
  .item.special {
    align-self: flex-end;
  }
</style>

<div class="container">
  <div class="item"></div>
  <div class="item special"></div>
  <div class="item"></div>
</div>
Try It Yourself

How It Works

The middle item ignores the container’s align-items: flex-start and moves to the bottom of the row.

Example 2 — Center a Single Item

Keep most items top-aligned, but center one featured card vertically.

align-self-center.css
.card-row {
  display: flex;
  align-items: flex-start;
  min-height: 180px;
}
.card.featured {
  align-self: center;
}
Try It Yourself

How It Works

Only the featured card uses align-self: center. The other cards follow the container default.

Example 3 — Stretch One Item Full Height

Make one sidebar stretch while sibling items keep their natural height.

align-self-stretch.css
.panel {
  display: flex;
  align-items: flex-start;
  height: 140px;
}
.sidebar {
  align-self: stretch;
}
Try It Yourself

How It Works

The sidebar grows to the full 140px height of the flex line even though other items are shorter.

📝 Text & Baseline Overrides

Use align-self: baseline when one item in a mixed-size text row needs special baseline alignment.

Example 4 — Baseline Override for One Item

Align one label to the text baseline while other items use a different default alignment.

align-self-baseline.html
<style>
  .label-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
  .label-row .caption {
    align-self: baseline;
    font-size: 0.875rem;
  }
</style>

<div class="label-row">
  <span style="font-size:2rem">Ag</span>
  <span class="caption">Caption</span>
</div>
Try It Yourself

How It Works

The caption ignores the container’s center alignment and lines up on the text baseline instead.

🧠 How align-self Works

1

Container sets the default

align-items on the flex or grid container defines the normal cross-axis alignment.

Default
2

One item gets align-self

The selected item uses its own keyword instead of inheriting through auto.

Override
3

That item moves on the cross axis

Only the targeted item changes position. Neighbors keep the container default.

Result
=

Precise item control

You get flexible layouts without changing alignment for every sibling.

Universal Browser Support

align-self is supported in all modern browsers for both flexbox and CSS Grid layouts.

Baseline · Flexbox & Grid

Item-level alignment you can rely on

Chrome, Firefox, Safari, Edge, and Opera support align-self in current versions.

98% Modern browser support
Google Chrome29+ flex · 57+ grid
Full support
Mozilla Firefox28+ flex · 52+ grid
Full support
Apple Safari9+ flex · 10.1+ grid
Full support
Microsoft Edge12+ flex · 16+ grid
Full support
OperaModern versions
Full support
align-self property 98% supported

Bottom line: Use align-self confidently for item-level alignment in modern layouts.

Conclusion

The align-self property gives you precise control over one flex or grid item on the cross axis. It is the perfect tool when most items should follow align-items, but one item needs its own alignment.

Start with auto, then override with values like flex-end, center, or stretch only where the layout truly needs an exception.

💡 Best Practices

✅ Do

  • Set align-items on the container first
  • Use align-self only for true one-off exceptions
  • Give the container a cross-axis size when testing alignment
  • Use semantic class names like .featured or .sidebar
  • Test overrides in responsive layouts

❌ Don’t

  • Apply align-self to every item when align-items would work
  • Confuse it with align-items or align-content
  • Forget that auto inherits from the container
  • Override alignment without a clear visual reason
  • Expect results without a defined flex or grid container

Key Takeaways

Knowledge Unlocked

Five things to remember about align-self

Use these points when overriding item alignment.

5
Core concepts
🔁02

auto

Inherits align-items.

Default
🛠03

Same Keywords

center, stretch, end.

Values
📦04

Flex + Grid

Works on both item types.

Scope
💡05

Use Sparingly

Prefer container defaults.

Maintain

❓ Frequently Asked Questions

The align-self property overrides the cross-axis alignment of a single flex item or grid item, instead of using the container's align-items value.
The initial value is auto. That means the item inherits alignment from the container's align-items property.
align-items sets the default alignment for all items in a container. align-self overrides that default for one specific item.
Yes. On grid items, align-self aligns the item inside its grid area along the block axis.
Use it when one item needs different cross-axis alignment than the rest, such as pinning a badge to the bottom of a card row.

Practice in the Live Editor

Open the HTML editor, override one flex item, and compare it with its siblings instantly.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful