CSS | align-self Property
The align-self property in CSS is used to align the selected items in the flexible container in many different manners such as flex-end, center, flex-start, etc.
Syntax:
align-self: auto|stretch|center|flex-start|flex-end|baseline| initial;
Property values:
auto: This property is used to inherits its parent container align-items property or stretched if it has no parent container. It is a default value.
- Syntax:
align-self: auto;
- Example:
<!DOCTYPE html><html><head><title>CSS | align-self Property</title><style>#geeks {width: 250px;height: 200px;border: 4px solid black;display: -webkit-flex;-webkit-align-items: flex-start;display: flex;align-items: flex-start;}#geeks div {-webkit-flex: 2;flex: 1;}#sudo {-webkit-align-self: auto;align-self: auto;}</style></head><body><center><h2style="color:green;">GeeksForGeeks</h2><h3style="color:green;">align-self:auto;</h3><divid="geeks"><divstyle="background-color:green;color:white;">Geeks</div><divstyle="background-color:lightblue;"id="sudo">For</div><divstyle="background-color:coral;">Geeks</div><divstyle="background-color:lightblue;">Sudo</div><divstyle="background-color:tomato;">Placement</div></div></center></body></html>chevron_rightfilter_none - Output:

stretch: This property is used to positioned the elements to fit the container.
- Syntax:
align-self: stretch;
- Example:
<!DOCTYPE html><html><head><title>CSS | align-self Property</title><style>#geeks {width: 250px;height: 200px;border: 4px solid black;display: -webkit-flex;-webkit-align-items: flex-start;display: flex;align-items: flex-start;}#geeks div {-webkit-flex: 2;flex: 1;}#sudo {-webkit-align-self: stretch;align-self: stretch;}</style></head><body><center><h2style="color:green;">GeeksForGeeks</h2><h3style="color:green;">align-self:stretch;</h3><divid="geeks"><divstyle="background-color:green;color:white;">Geeks</div><divstyle="background-color:lightblue;"id="sudo">For</div><divstyle="background-color:coral;">Geeks</div><divstyle="background-color:lightblue;">Sudo</div><divstyle="background-color:tomato;">Placement</div></div></center></body></html>chevron_rightfilter_none - Output:

Center: This Property is used to place the item at the center of the flexible container.
- Syntax:
align-self: center;
- Example:
<!DOCTYPE html><html><head><title>CSS | align-self Property</title><style>#geeks {width: 250px;height: 200px;border: 4px solid black;display: -webkit-flex;-webkit-align-items: flex-start;display: flex;align-items: flex-start;}#geeks div {-webkit-flex: 1;flex: 1;}#sudo {-webkit-align-self: center;align-self: center;}</style></head><body><center><h2style="color:green;">GeeksForGeeks</h2><h3style="color:green;">align-self:center;</h3><divid="geeks"><divstyle="background-color:green;color:white;">Geeks</div><divstyle="background-color:lightblue;"id="sudo">For</div><divstyle="background-color:coral;">Geeks</div><divstyle="background-color:lightblue;">Sudo</div><divstyle="background-color:tomato;">Placement</div></div></center></body></html>chevron_rightfilter_none - Output:

- Syntax:
align-self: flex-start;
- Example:
<!DOCTYPE html><html><head><title>CSS | align-self Property</title><style>#geeks {width: 250px;height: 200px;border: 4px solid black;display: -webkit-flex;-webkit-align-items: flex-start;display: flex;align-items: flex-start;}#geeks div {-webkit-flex: 1;flex: 1;}#sudo {-webkit-align-self: flex-start;align-self: flex-start;}</style></head><body><center><h2style="color:green;">GeeksForGeeks</h2><h3style="color:green;">align-self:flex-start;</h3><divid="geeks"><divstyle="background-color:green;color:white;">Geeks</div><divstyle="background-color:lightblue;"id="sudo">For</div><divstyle="background-color:coral;">Geeks</div><divstyle="background-color:lightblue;">Sudo</div><divstyle="background-color:tomato;">Placement</div></div></center></body></html>chevron_rightfilter_none - Output:

flex-start: This property is used to align the selected item at the beginning of the flexible container.
flex-end: This Property is used to position the selected item at the end of the flexible container.
- Syntax:
align-self: flex-end;
- Example:
<!DOCTYPE html><html><head><title>CSS | align-self Property</title><style>#geeks {width: 250px;height: 200px;border: 4px solid black;display: -webkit-flex;-webkit-align-items: flex-start;display: flex;align-items: flex-start;}#geeks div {-webkit-flex: 1;flex: 1;}#sudo {-webkit-align-self: flex-end;align-self: flex-end;}</style></head><body><center><h2style="color:green;">GeeksForGeeks</h2><h3style="color:green;">align-self:flex-end;</h3><divid="geeks"><divstyle="background-color:green;color:white;">Geeks</div><divstyle="background-color:lightblue;"id="sudo">For</div><divstyle="background-color:coral;">Geeks</div><divstyle="background-color:lightblue;">Sudo</div><divstyle="background-color:tomato;">Placement</div></div></center></body></html>chevron_rightfilter_none - Output:

Baseline: The item is placed at the baseline of the flexible container.
- Syntax:
align-self: baseline;
- Example:
<!DOCTYPE html><html><head><title>CSS | align-self Property</title><style>#geeks {width: 250px;height: 200px;border: 4px solid black;display: -webkit-flex;/* Safari */-webkit-align-items: center;/* Safari 7.0+ */display: flex;align-items: center;}#geeks div {-webkit-flex: 1;/* Safari 6.1+ */flex: 1;}#sudo {-webkit-align-self: baseline;/* Safari 7.0+ */align-self: baseline;}</style></head><body><center><h2style="color:green;">GeeksForGeeks</h2><h3style="color:green;">align-self:baseline;</h3><divid="geeks"><divstyle="background-color:green;color:white;">Geeks</div><divstyle="background-color:lightblue;"id="sudo">For</div><divstyle="background-color:coral;">Geeks</div><divstyle="background-color:lightblue;">Sudo</div><divstyle="background-color:tomato;">Placement</div></div></center></body></html>chevron_rightfilter_none - Output:

initial: It sets the property to its normal position. It is the default value.
- Syntax:
align-self: initial;
- Example:
<!DOCTYPE html><html><head><title>CSS | align-self Property</title><style>#geeks {width: 250px;height: 200px;border: 4px solid black;display: -webkit-flex;/* Safari */-webkit-align-items: flex-start;/* Safari 7.0+ */display: flex;align-items: flex-start;}#geeks div {-webkit-flex: 1;/* Safari 6.1+ */flex: 1;}#sudo {-webkit-align-self: initial;/* Safari 7.0+ */align-self: initial;}</style></head><body><center><h2style="color:green;">GeeksForGeeks</h2><h3style="color:green;">align-self:initial;</h3><divid="geeks"><divstyle="background-color:green;color:white;">Geeks</div><divstyle="background-color:lightblue;"id="sudo">For</div><divstyle="background-color:coral;">Geeks</div><divstyle="background-color:lightblue;">Sudo</div><divstyle="background-color:tomato;">Placement</div></div></center></body></html>chevron_rightfilter_none - Output:

Supported browsers: The browser supported by CSS | align-self Property are listed below:
`
- Google Chrome 21.0
- Internet Explorer 11.0
- Firefox 28.0
- Opera 12.1
- Safari 9.0, 7.0 -webkit-
Recommended Posts:
- HTML | DOM Style alignSelf Property
- CSS | transition-property Property
- CSS | right Property
- CSS | nav-down property
- CSS | top Property
- CSS | all Property
- CSS | nav-right property
- CSS | clip Property
- CSS | perspective Property
- CSS overflow-y Property
- CSS | transition Property
- CSS | flex Property
- CSS | resize Property
- CSS | left Property
- CSS | grid-row Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh



