Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
Title: 'justify-content'
Description: 'Aligns and distributes space between items along the main axis in Flexbox or the inline axis in Grid.'
Subjects:
- 'Web Design'
- 'Web Development'
Tags:
- 'Flexbox'
- 'Layout'
CatalogContent:
- 'learn-css'
- 'paths/front-end-engineer-career-path'
- 'paths/full-stack-engineer-career-path'
---

The **`justify-content`** property aligns and distributes space between items along the main axis of a flex container, or aligns [`grid's`](https://www.codecademy.com/resources/docs/css/grids) tracks along the inline axis of a grid container.

## Syntax

```pseudo
justify-content: value;
```

**Parameters:**

- `value`: Specifies how content is aligned or spaced. Common values include:
- `space-around`
- `space-between`
- `space-evenly`
- `stretch`
- `center`
- `flex-start`
- `flex-end`
- `start`
- `end`

## Example

In the following example, the `justify-content: space-around` property is used to distribute the flex items along the main axis. This creates equal space between the items, and half-sized spaces on both ends of the container:

```css
.flex-container {
display: flex;
justify-content: space-around;
width: 500px;
padding: 1rem 0;
border: 3px solid white;
}
```

The output of the above code block is shown below:

![An image showing how flex items align along the container's main axis.](https://raw.githubusercontent.com/Codecademy/docs/main/media/justify-content-example.png)
Binary file added media/justify-content-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.