X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Style alignSelf Property

Style Object Reference Style Object

Example

Set the alignments for one of the items inside a flexible element to fit the container:

// Code for Safari 7.0+
document.getElementById("myBlueDiv").style.WebkitAlignSelf = "stretch";

// Standard syntax
document.getElementById("myBlueDiv").style.alignSelf = "stretch";

Try it yourself »


Definition and Usage

The alignSelf property specifies the alignment for the selected item inside the flexible container.

Note: The alignSelf property overrides the flexible container's alignItems property.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Numbers followed by Webkit specify the first version that worked with a prefix.

Property
alignSelf 21.0 11.0 20.0 7.0 Webkit 12.1

Note: Safari support an alternative, the WebkitAlignSelf property.


Syntax

Return the alignSelf property:

object.style.alignSelf

Set the alignSelf property:

object.style.alignSelf="auto|stretch|center|flex-start|flex-end|baseline|initial|inherit"

Property Values

Value Description
auto Default. The element inherits its parent container's align-items property, or "stretch" if it has no parent container
stretch The element is positioned to fit the conatiner
center The element is positioned at the center of the container
flex-start The element is are positioned at the beginning of the container
flex-end The element is positioned at the end of the container
baseline The element is positioned at the baseline of the container
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: auto
Return Value: A String, representing the align-self property of an element
CSS Version CSS3


Related Pages

CSS reference: align-self property

HTML DOM STYLE Reference: alignContent property

HTML DOM STYLE Reference: alignItems property


Style Object Reference Style Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook