CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES

CSS3 justify-content Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The justify-content CSS property specifies how flex items are aligned along the main axis of the flex container after any flexible lengths and auto margins have been resolved.

The following table summarizes the usages context and the version history of this property.

Default value: flex-start
Applies to: Flex containers
Inherited: No
Animatable: No. See animatable properties.
Version: New in CSS3

Syntax

The syntax of the property is given with:

justify-content: 
flex-start | flex-end | center | space-between | space-around | initial | inherit

The example below shows the justify-content property in action.

.flex-container {
    /* Safari */
    display: -webkit-flex;
    -webkit-justify-content: space-around;
    /* Standard syntax */
    display: flex;
    justify-content: space-around;
}

Property Values

The following table describes the values of this property.

Value Description
flex-start Flex items are packed toward the start of the line. This is default value.
flex-end Flex items are packed toward the end of the line.
center Flex items are packed toward the center of the line.
space-between Flex items are evenly distributed along the line.
space-around Flex items are evenly distributed so that the space between two adjacent items is the same.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element justify-content property.

Browser Compatibility

The justify-content property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 18+ -moz-, 28+
  • Google Chrome 21+ -webkit-, 29+
  • Internet Explorer 11+
  • Apple Safari 6.1+
  • Opera 12.1+

Further Reading

See tutorial on: CSS Fonts, CSS Units, CSS Pseudo-elements.

Related properties: align-content, align-items, align-self, display, flex, flex-basis, flex-direction, flex-flow, flex-grow, flex-shrink, flex-wrap, justify-content, min-height, min-width, order.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties