YouTip LogoYouTip

Prop Style Justifycontent

HTML DOM Style justifyContent Property

HTML DOM Style justifyContent Property

-- Learning not just technology, but dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

<source>

HTML DOM Table Object

Style justifyContent Property

Style Object Reference Style Object

Example

Add space around the items in a flexible <div> element:

document.getElementById("main".style.justifyContent="space-between";

Try it Yourself Β»


Definition and Usage

The justifyContent property aligns the items inside a flexible container when the items do not use all available space along the main axis (horizontally).

Tip: Use the alignContent property to align the items along the cross axis (vertically).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Firefox, Opera, and Chrome support the justify-content property.


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 in 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 the element.
CSS Version: CSS3

Related Articles

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 Reference Style Object

← Prop Style OpacityCss Animatable β†’