CSS align-self Property | CSS References
Example
Center the alignments for one of the items inside a flexible element:
#myBlueDiv {
-webkit-align-self: center; /* Safari 7.0+ */
align-self: center;
}
Definition and Usage
The align-self property specifies the alignment for the selected item inside the flexible container.
Note: The align-self property overrides the flexible container’s align-items property.
| Default value: | auto |
|---|---|
| Inherited: | no |
| Animatable: | no. |
| Version: | CSS3 |
| JavaScript syntax: | object.style.alignSelf=”center” Try it |
CSS Syntax
align-self: auto|stretch|center|flex-start|flex-end|baseline|initial|inherit;
Property Values
| Value | Description | CSS Code |
|---|---|---|
| auto | Default. The element inherits its parent container’s align-items property, or “stretch” if it has no parent container | div#myBlueDiv { align-self:auto; } |
| stretch | The element is positioned to fit the container | div#myBlueDiv { align-self:stretch; } |
| center | The element is positioned at the center of the container | div#myBlueDiv { align-self:center; } |
| flex-start | The element is positioned at the beginning of the container | div#myBlueDiv { align-self:flex-start; } |
| flex-end | The element is positioned at the end of the container | div#myBlueDiv { align-self:flex-end; } |
| baseline | The element is positioned at the baseline of the container | div#myBlueDiv { align-self:baseline; } |
| initial | Sets this property to its default value. | div#myBlueDiv { align-self:initial; } |
| inherit | Inherits this property from its parent element. | div#myBlueDiv { align-self:inherit; } |
