Open Playground
CSS FlexboxLesson #177

Flexbox Justify Content

The `justify-content` property

CSS justify-content Property

The justify-content property aligns the flex items along the main-axis (horizontally).

This property can have one of the following values:

  • center
  • flex-start (default)
  • flex-end
  • space-around
  • space-between
  • space-evenly

Example

Example Code

css
Try it Yourself
.flex-container {

  display: flex;

  justify-content: center;
}

Example

Example Code

css
Try it Yourself
.flex-container {

  display: flex;

  justify-content: flex-start;
}

Example

Example Code

css
Try it Yourself
.flex-container {

  display: flex;

  justify-content: flex-end;
}

Example

Example Code

css
Try it Yourself
.flex-container {

  display: flex;

  justify-content: space-around;
}

Example

Example Code

css
Try it Yourself
.flex-container {

  display: flex;

  justify-content: space-between;
}

Example

Example Code

css
Try it Yourself
.flex-container {

  display: flex;

  justify-content: space-evenly;
}


Interactive Code Examples

CSS Example 1

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 2

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 3

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 4

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 5

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 6

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview: