Favorites

CSS <content-distribution> Data Type

<content-distribution>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <content-distribution> data type is a keyword that shares out extra space between items: space-between, space-around, space-evenly or stretch.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <content-distribution> CSS data type represents the keywords that spread extra space between or around the items of a flex or grid container, rather than moving the items as a group. It is used by justify-content, align-content and the place-content shorthand.

The four keywords differ in how the leftover space is shared. space-between puts the first item at the start, the last at the end, and equal gaps between them. space-around gives every item an equal amount of space on each side, so the gaps at the edges are half the size of the gaps between items. space-evenly makes every gap the same, including the edges. stretch grows auto-sized items (or grid tracks) to fill the space instead of adding gaps.

If there is not enough space to distribute, or only one item, each keyword falls back to a <content-position>: space-between behaves like flex-start, space-around and space-evenly behave like center, and stretch behaves like flex-start.

Examples:

.toolbar {
  display: flex;
  justify-content: space-between;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  justify-content: space-evenly;
}

.rows {
  display: flex;
  flex-wrap: wrap;
  height: 400px;
  align-content: space-around;
}

Interactive Demo

One
Two
Three
Demo Code
HTML Code
<div class="demo-element">
	<div>One</div>
	<div>Two</div>
	<div>Three</div>
</div>
CSS Code
.demo-element > div {
	padding: 10px 12px;
	background: #4361ee;
	color: #fff;
	font-size: 14px;
	font-weight: bold;
}
.demo-element {
	display: grid;
	grid-auto-flow: column;
	width: 300px;
	gap: 0;
	padding: 6px;
	box-sizing: border-box;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
	justify-content: space-between;
}

Syntax

<content-distribution> = space-between | space-around | space-evenly | stretch

Values

  • space-betweenThe first item is at the start, the last at the end, and the remaining space is shared equally between the items.
  • space-aroundEach item gets an equal amount of space on both sides, so the gaps at the edges are half the gaps between items.
  • space-evenlyAll gaps, including those at the start and end, are the same size.
  • stretchAuto-sized items or tracks grow to fill the available space.

Example

<div class="wrap">
<h1>CSS &lt;content-distribution&gt; examples</h1>
<div class="grid">
<div class="card">
<div class="box between"><span></span><span></span><span></span></div>
<div class="label">justify-content: space-between</div>
</div>
<div class="card">
<div class="box around"><span></span><span></span><span></span></div>
<div class="label">justify-content: space-around</div>
</div>
<div class="card">
<div class="box evenly"><span></span><span></span><span></span></div>
<div class="label">justify-content: space-evenly</div>
</div>
<div class="card">
<div class="box stretch"><span></span><span></span><span></span></div>
<div class="label">grid with justify-content: stretch</div>
</div>
</div>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fb;
  color: #102a43;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  color: #486581;
  margin-top: 10px;
  word-break: break-word;
}

.note {
  font-size: 13px;
  color: #486581;
  margin-top: 14px;
}

/*  examples */
.box {
  display: flex;
  gap: 6px;
  height: 110px;
  padding: 8px;
  border-radius: 10px;
  background: #e2e8f0;
}

.box span {
  width: 22px;
  border-radius: 6px;
  background: #2563eb;
}

.box span:nth-child(2) { height: 60%; }
.box span:nth-child(3) { height: 40%; }

.box span { height: 100% !important; }
.between { justify-content: space-between; }
.around { justify-content: space-around; }
.evenly { justify-content: space-evenly; }
.stretch span { width: auto; }
.stretch { display: grid; grid-auto-flow: column; justify-content: stretch; }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS content-distribution data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.