Currently Empty: ₹0.00
CSS Align Self
CSS CODES & EXAMPLES
CSS Align Self
Learn how the CSS align-self property allows
you to override the align-items setting for
an individual flex item.
01
What is Align Self?
Control one flex item independently
The align-self property controls the alignment
of a single flex item on the cross axis. It can override the
alignment defined by the parent container’s
align-items property.
Remember:
align-items controls all flex items, while
align-self controls one individual flex item.
02
Syntax
Basic CSS syntax
align-self.css
.item {
align-self: center;
}
03
align-self: auto
Use the parent’s align-items value
auto is the default value. The item follows the
align-items value of its parent.
auto.css
.container {
display: flex;
align-items: center;
}
.item {
align-self: auto;
}1
2
3
04
align-self: flex-start
Move one item to the start
flex-start moves the selected item to the
beginning of the cross axis.
flex-start.css
.container {
display: flex;
align-items: center;
}
.item-special {
align-self: flex-start;
}1
2
3
05
align-self: flex-end
Move one item to the end
flex-end moves the selected item to the end of
the cross axis.
flex-end.css
.container {
display: flex;
align-items: center;
}
.item-special {
align-self: flex-end;
}1
2
3
06
align-self: center
Center one specific item
center centers the selected flex item on the
cross axis.
center.css
.container {
display: flex;
align-items: flex-start;
}
.item-special {
align-self: center;
}1
2
3
07
align-self: stretch
Stretch one individual item
stretch allows an individual flex item to
stretch across the cross axis when its cross-size is not
explicitly defined.
stretch.css
.container {
display: flex;
align-items: flex-start;
}
.item-special {
align-self: stretch;
}1
2
3
08
align-self: baseline
Align one item according to its text baseline
baseline aligns the selected item with the
baseline of the other flex items.
baseline.css
.container {
display: flex;
align-items: center;
}
.item-special {
align-self: baseline;
}Small
Large
Medium
09
Align Self Comparison
Different values on individual itemsflex-start
1
2
3
center
1
2
3
flex-end
1
2
3
stretch
1
2
3
10
Align Items vs Align Self
Understand the difference| Property | Controls | Applied To |
|---|---|---|
align-items | Cross-axis alignment | All flex items |
align-self | Cross-axis alignment | One flex item |
Example:
If the parent has
align-items: center;, you can move only one
child to the bottom using
align-self: flex-end;.
11
Practical Website Example
Highlight one course card item
In a course layout, the parent can center all elements while
one badge or button can be positioned differently using
align-self.
course-card.css
.course-card {
display: flex;
align-items: center;
gap: 18px;
}
.course-badge {
align-self: flex-start;
}CSS Web Designing
Learn modern CSS, Flexbox, Grid and responsive layouts.
12
Align Self with Column
Cross-axis behavior changes with direction
column.css
.container {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.item-special {
align-self: flex-end;
}Item 1
Item 2
Item 3
With flex-direction: column, the cross axis is
horizontal. Therefore, align-self: flex-end
moves the selected item toward the right side.
13
Quick Reference
Important align-self valuesauto
Uses the parent’s align-items value.
flex-startAligns one item at the beginning.
flex-endAligns one item at the end.
stretchStretches one item across the cross axis.
baselineAligns one item according to its text baseline.
14
Important Points
Remember these rules
✓
align-self works on an individual flex item.
✓
It can override the parent’s align-items.
✓
It controls the cross-axis alignment.
✓
Its default value is auto.
15
Practice Task
Control individual flex items🎯 Build a Flexible Course Row
Create a row containing three course cards. Use
align-items on the parent and
align-self on one individual card.
- Set the parent to
display: flex; - Use
align-items: center; - Move the second item using
align-self - Try
flex-start,centerandflex-end
16
CSS Align Self Live Example
Run the practical exampleLIVE PREVIEW



