box-align property CSS Reference



Definition and Usage

The box-align property specifies how to align the child elements of a box.

Default value: stretch
Inherited: no
Version: CSS3
JavaScript syntax: object.style.boxAlign="center"

Syntax

 box-align: start|end|center|baseline|stretch;

Values

Value Description
start For normal direction boxes, the top edge of each child is placed along the top of the box. For reverse direction boxes, the bottom edge of each child is placed along the bottom of the box
end For normal direction boxes, the bottom edge of each child is placed along the bottom of the box. For reverse direction boxes, the top edge of each child is placed along the top of the box
center Any extra space is divided evenly, with half placed above the child and the other half placed below the child
baseline If box-orient is inline-axis or horizontal, all children are placed with their baselines aligned
stretch The child elements are stretched to fill the containing block

Examples

div {
    width:350px;
    height:100px;
    border:1px solid black;
    /* Internet Explorer 10 */
    display:-ms-flexbox;
    -ms-flex-pack:center;
    -ms-flex-align:center;
    /* Firefox */
    display:-moz-box;
    -moz-box-pack:center;
    -moz-box-align:center;
    /* Safari, Opera, and Chrome */
    display:-webkit-box;
    -webkit-box-pack:center;
    -webkit-box-align:center;
    /* W3C */
    display:box;
    box-pack:center;
    box-align:center;
}

Relative articles