Style justifyContent Property
Example
Make some space between the items of the flexible <div> element:
document.getElementById("main".style.justifyContent = "space-between";Try it yourself »
Definition and Usage
The justifyContent property aligns the flexible container's items when the items do not use all available space on the main-axis (horizontally).
Tip: Use the alignContent property to align the items on the cross-axis (vertically).
Browser Support
![]()
The justify-content property is supported in Firefox, Opera, and Chrome.
Syntax
Return the justifyContent property:
object.style.justifyContent
Set the justifyContent property:
object.style.justifyContent="flex-start|flex-end|center|space-between|space-around|initial|inherit"
Property Values
| Value | Description |
|---|---|
| flex-start | Default value. Items are positioned at the beginning of the container |
| flex-end | Items are positioned at the end of the container |
| center | Items are positioned at the center of the container |
| space-between | Items are positioned with space between the lines |
| space-around | Items are positioned with space before, between, and after the lines |
| 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: | flex-start |
|---|---|
| Return Value: | A String, representing the justify-content property of an element |
| CSS Version | CSS3 |
Related Pages
CSS reference: justify-content property
HTML DOM STYLE Reference: alignContent property
HTML DOM STYLE Reference: alignItems property
HTML DOM STYLE Reference: alignSelf property
Style Object

