Javatpoint Logo
Javatpoint Logo

CSS Justify-Content Property

The CSS property justify-content indicates how the flexible box container is aligned. It includes the area between and around content items along a flex container's main axis spread across a browser.

Note that this attribute can describe nothing along the vertical axis. The align-items attribute may be used to align the elements vertically.

If there is at least one flexible element with a flex-grow property other than 0 in a Flexbox layout, then it will not influence & has no effect since there won't be any accessible space. The alignment is feasible after applying the lengths and auto margins settings.

Syntax

This property's default value is flex-start. Let's have a thorough understanding of its property worth.

Property Values

  • Flex-start: The default setting for aligning flex elements from the beginning of the container is flex-start.
  • Inherit: The elements are arranged according to the value of their inherited parent element.
  • Flex-end: It aligns flex elements at the container's end.
  • Center: The container's center is where the flex elements are aligned.
  • Space-between: Flex items are arranged with equal spacing, with the first thing pushed to the front and the final item pushed to the back.
  • Space-around: The flexible elements are positioned before, between, and after each other, and the corners with equal spacing.
  • Space-evenly: The items are arranged uniformly in space, but the distances from the corners differ.

Flex-start

Example: This example shows the justify-content property with the property value set to flex-start to align the item from the container's beginning.

Syntax

Program

Output

CSS Justify-Content Property

Flex-end

Example: This example shows the justify-content property with the property value specified as flex-end.

Syntax

Program

Output

CSS Justify-Content Property

Center

Example: This example shows the justify-content property with the value adjusted to the center.

Syntax

Program

Output

CSS Justify-Content Property

Space-between

Example: This example shows the justify-content property with the property value specified as space-between.

Syntax

Program

Output

CSS Justify-Content Property

Space-around

Example: This example displays the justify-content property with the property value specified as space-around.

Syntax

Program

Output

CSS Justify-Content Property

Space-evenly

Example: This example displays the justify-content property with the property value defined as space-evenly.

Syntax

Program

Output

CSS Justify-Content Property

Initial

Example: This example shows how to use the justify-content property with the property value set to initial.

Syntax

Program

Output

CSS Justify-Content Property

Inherit

Example: This example displays the way the justify-content property works when the property value has been set to inherit.

Syntax

Program

Output

CSS Justify-Content Property

Web Browsers Supported

The list of supported browsers for the CSS justify-content attribute follows:

  1. Google Chrome version 29.0 and above
  2. Using Internet Explorer 11.0 or higher
  3. Microsoft Edge version 12.0 and above
  4. Opera 12.1 and above
  5. Firefox 20.0
  6. For Safari 9.0 and above






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA