zfb
GitHub repository

Type to search...

to open search from anywhere

Alignment

Align items, individual items, and grid content along supported axes.

Use alignment utilities on a flex or grid container to position its children. items aligns along a flex container’s cross axis and the grid block axis; justify controls the main axis in flex layouts, place-items combines both grid item axes, and self overrides one item.

Quick reference

Example classExpected declarations
items-centeralign-items: center;
justify-betweenjustify-content: space-between;
self-endalign-self: flex-end;
place-items-centerplace-items: center;
justify-items-centerjustify-items: center;
justify-self-endjustify-self: end;
place-content-betweenplace-content: space-between;
place-self-startplace-self: start;
self-startalign-self: flex-start;
Example setup

Every preview explicitly starts from spec 1, reset "none", strict mode, spacingUnit "0.25rem", and no breakpoints. Numeric spacing values multiply that unit; no Tailwind theme is inherited. wind-demo classes are authored presentation scaffolding, with their CSS shown beside the exact HTML source.

Examples in use

Align a flex row

justify-between distributes items along the row; items-center aligns them across it, while self-end overrides one child's cross-axis position.

Align a flex row
HTML
<div class="wind-demo">
  <p class="wind-demo-note">On a row, justify-content moves along the main axis and align-items moves across it.</p>
  <div class="wind-demo-frame flex h-32 w-full items-center justify-between gap-2">
    <div class="wind-demo-tile">Start</div><div class="wind-demo-tile self-end">Self end</div><div class="wind-demo-tile">End</div>
  </div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-note {
  color: #53677f;
  font-size: .875rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.self-end {
  align-self: flex-end;
}
.h-32 {
  height: 8rem;
}
.w-full {
  width: 100%;
}
.gap-2 {
  column-gap: 0.5rem;
  row-gap: 0.5rem;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-note": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "flex",
        "gap-2",
        "h-32",
        "items-center",
        "justify-between",
        "self-end",
        "w-full"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-note { color: #53677f; font-size: 0.875rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Align grid items on both axes

place-items-center centers grid items, justify-items-center controls the inline axis, place-content-between distributes the grid tracks, and separate tiles demonstrate justify-self-end, place-self-start, and self-start.

Align grid items on both axes
HTML
<div class="wind-demo">
  <p class="wind-demo-note">place-items sets both axes for each grid item; self overrides one item.</p>
  <div class="wind-demo-frame grid grid-cols-2 grid-rows-2 h-36 place-items-center justify-items-center place-content-between gap-2">
    <div class="wind-demo-tile justify-self-end">Justify self end</div><div class="wind-demo-tile place-self-start">Place self start</div>
    <div class="wind-demo-tile self-start">Self start</div><div class="wind-demo-tile">Centered</div>
  </div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-note {
  color: #53677f;
  font-size: .875rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.grid {
  display: grid;
}
.grid-cols-2 {
  grid-template-columns: repeat(2,minmax(0,1fr));
}
.grid-rows-2 {
  grid-template-rows: repeat(2,minmax(0,1fr));
}
.justify-items-center {
  justify-items: center;
}
.justify-self-end {
  justify-self: end;
}
.place-content-between {
  place-content: space-between;
}
.place-items-center {
  place-items: center;
}
.place-self-start {
  place-self: start;
}
.self-start {
  align-self: flex-start;
}
.h-36 {
  height: 9rem;
}
.gap-2 {
  column-gap: 0.5rem;
  row-gap: 0.5rem;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-note": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "gap-2",
        "grid",
        "grid-cols-2",
        "grid-rows-2",
        "h-36",
        "justify-items-center",
        "justify-self-end",
        "place-content-between",
        "place-items-center",
        "place-self-start",
        "self-start"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-note { color: #53677f; font-size: 0.875rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Custom and named values

These roots accept fixed keywords. Newly admitted justify-self, justify-items, and place-self use start, end, center, stretch, baseline. Place-content uses start, end, center, stretch, between (space-between), around (space-around), and evenly (space-evenly). Place-self sets align-self and justify-self; place-content sets align-content and justify-content. Existing place-items is unchanged. The new roots do not admit flex-start or flex-end as utility suffixes; CSS itself may use those values, and existing items, self, and justify retain their flex-start/flex-end emissions.

Related guides: Utility grammar · Variants

Catalog details

items

FieldValue
Catalog identifierv1.items
Class patternitems-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values5
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesalign-items

Accepted values

KindSuffixEmitted value
keyword"start""flex-start"
keyword"end""flex-end"
keyword"center""center"
keyword"baseline""baseline"
keyword"stretch""stretch"

Declaration templates

PropertyValue kindFixed value
align-itemsresolvednull

Catalog examples

Example classExpected declarations
items-centeralign-items: center

justify

FieldValue
Catalog identifierv1.justify
Class patternjustify-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values6
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesjustify-content

Accepted values

KindSuffixEmitted value
keyword"start""flex-start"
keyword"end""flex-end"
keyword"center""center"
keyword"between""space-between"
keyword"around""space-around"
keyword"evenly""space-evenly"

Declaration templates

PropertyValue kindFixed value
justify-contentresolvednull

Catalog examples

Example classExpected declarations
justify-centerjustify-content: center

justify-items

FieldValue
Catalog identifierv1.justify-items
Class patternjustify-items-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values5
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesjustify-items

Accepted values

KindSuffixEmitted value
keyword"start""start"
keyword"end""end"
keyword"center""center"
keyword"stretch""stretch"
keyword"baseline""baseline"

Declaration templates

PropertyValue kindFixed value
justify-itemsresolvednull

Catalog examples

Example classExpected declarations
justify-items-centerjustify-items: center

justify-self

FieldValue
Catalog identifierv1.justify-self
Class patternjustify-self-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values5
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesjustify-self

Accepted values

KindSuffixEmitted value
keyword"start""start"
keyword"end""end"
keyword"center""center"
keyword"stretch""stretch"
keyword"baseline""baseline"

Declaration templates

PropertyValue kindFixed value
justify-selfresolvednull

Catalog examples

Example classExpected declarations
justify-self-centerjustify-self: center

place-content

FieldValue
Catalog identifierv1.place-content
Class patternplace-content-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values7
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesplace-content

Accepted values

KindSuffixEmitted value
keyword"start""start"
keyword"end""end"
keyword"center""center"
keyword"stretch""stretch"
keyword"between""space-between"
keyword"around""space-around"
keyword"evenly""space-evenly"

Declaration templates

PropertyValue kindFixed value
place-contentresolvednull

Catalog examples

Example classExpected declarations
place-content-centerplace-content: center

place-items

FieldValue
Catalog identifierv1.place-items
Class patternplace-items-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values4
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesplace-items

Accepted values

KindSuffixEmitted value
keyword"start""start"
keyword"end""end"
keyword"center""center"
keyword"stretch""stretch"

Declaration templates

PropertyValue kindFixed value
place-itemsresolvednull

Catalog examples

Example classExpected declarations
place-items-centerplace-items: center

place-self

FieldValue
Catalog identifierv1.place-self
Class patternplace-self-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values5
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesplace-self

Accepted values

KindSuffixEmitted value
keyword"start""start"
keyword"end""end"
keyword"center""center"
keyword"stretch""stretch"
keyword"baseline""baseline"

Declaration templates

PropertyValue kindFixed value
place-selfresolvednull

Catalog examples

Example classExpected declarations
place-self-centerplace-self: center

self

FieldValue
Catalog identifierv1.self
Class patternself-<suffix>
Grammar{"acceptedKinds":["keyword"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values5
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankalignment (7)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesalign-self

Accepted values

KindSuffixEmitted value
keyword"start""flex-start"
keyword"end""flex-end"
keyword"center""center"
keyword"baseline""baseline"
keyword"stretch""stretch"

Declaration templates

PropertyValue kindFixed value
align-selfresolvednull

Catalog examples

Example classExpected declarations
self-centeralign-self: center

Revision History

CreatedUpdated