CSS align self
Created By: chatGPT
The Here’s an example demonstrating the use of
align-self
property in CSS allows you to override the align-items
property for specific flex items within a flex container. It enables individual flex items to be positioned independently along the cross axis. Here's how it works:You can set the align-self
property to one of several values:
flex-start
: Aligns the item at the start of the cross axis.flex-end
: Aligns the item at the end of the cross axis.center
: Centers the item along the cross axis.baseline
: Aligns the item along the baseline of the container.stretch
: Stretches the item to fill the container (this is the default).
align-self
:Item 1
Item 2
Item 3
In this example, we have a flex container with three items. Each item uses a different align-self
value:
- Item 1 is aligned at the start of the container.
- Item 2 is centered.
- Item 3 is aligned at the end of the container. You can see how this property allows for great flexibility when arranging items within a flex layout.