CSS justify-self Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Flexbox & Grid

What You’ll Learn

The justify-self property lets you override inline-axis alignment for a single grid item inside its cell. It is the item-level companion to justify-items, useful when one box needs different horizontal placement than its neighbors.

01

Item Override

Align one item differently.

02

Syntax

Apply it on the item.

03

auto Value

Inherits justify-items.

04

CSS Grid

Inline axis in cells.

05

Keywords

start, center, end.

06

vs justify-items

One item vs all items.

Introduction

The justify-self property in CSS is used to align an individual grid item along the inline (row) axis within its grid area. While justify-items sets the default for every item in the container, justify-self lets one item break that rule.

This is helpful for layouts like a product grid where one featured card is centered in its column while the rest stay start-aligned, or a dashboard tile where a badge sits at the trailing edge of its cell.

Definition and Usage

Apply justify-self to a grid item, not to the grid container. Use it when a single item needs a different inline-axis position than the container’s justify-items value provides.

💡
Beginner Tip

Set justify-items on the grid container for the group, then use justify-self only on the item that needs a different alignment. Give items a width smaller than their cell so start, center, and end are visible.

📝 Syntax

Apply justify-self to a grid item:

syntax.css
.item {
  justify-self: value;
}

Basic Grid Example

justify-self-basic.css
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-items: start;
}

.item.featured {
  justify-self: center;
}
justify-self: auto; justify-self: start; justify-self: center; justify-self: end;

Default Value

The default value of justify-self is auto, which means the item follows the alignment set by the container’s justify-items property.

Syntax Rules

  • Apply justify-self to the grid item, not the container.
  • The default value is auto, which uses the container’s justify-items value.
  • Accepted keywords match justify-items: start, end, center, and stretch.
  • Alignment is visible when the item is smaller than its grid area along the inline axis.
  • Use it sparingly for exceptions; too many overrides can make layouts harder to maintain.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toGrid items
InheritedNo
AnimatableNo
Common useOverride inline-axis alignment for one grid item

💎 Property Values

ValueDescription
autoInherits alignment from the container’s justify-items property.
startAligns the item at the start of the grid area’s inline axis.
endAligns the item at the end of the grid area’s inline axis.
centerCenters the item along the grid area’s inline axis.
stretchStretches the item to fill the grid area along the inline axis.

justify-self vs justify-items

PropertyApplied toBest for
justify-itemsGrid containerDefault inline-axis alignment for all items
justify-selfIndividual grid itemOne item that needs different horizontal placement
align-selfIndividual flex or grid itemBlock-axis override inside a cell or flex line

👀 Live Preview

A grid with justify-items: start and one item using justify-self: center:

1
2
3

Examples Gallery

Align three items differently, override a container default, center one highlighted tile, and compare auto with an explicit override.

🚀 CSS Grid Layouts

Use justify-self to control inline-axis alignment for individual grid items inside their cells.

Example 1 — Start, Center, and End on Three Items

Give each grid item its own inline-axis alignment in the same row.

justify-self-values.css
.item-1 { justify-self: start; }
.item-2 { justify-self: center; }
.item-3 { justify-self: end; }
Try It Yourself

How It Works

Each item gets its own inline-axis rule, so you can demonstrate all three alignments side by side in one grid row.

Example 2 — Override justify-items

Keep the container at justify-items: start but push one featured card to the end of its cell.

justify-self-override.css
.grid {
  justify-items: start;
}

.featured {
  justify-self: end;
}
Try It Yourself

How It Works

justify-self wins over the container’s justify-items for that one item only.

Example 3 — Center One Highlighted Item

Center a single tile while siblings stay at the start of their cells.

justify-self-center.css
.highlight {
  justify-self: center;
}
Try It Yourself

How It Works

Only the highlighted item moves to the center of its column; the others follow the container’s start alignment.

Example 4 — Default auto Behavior

Items with justify-self: auto inherit the container’s justify-items: center rule.

justify-self-auto.css
.grid {
  justify-items: center;
}

.custom {
  justify-self: start;
}
Try It Yourself

How It Works

auto is the default. Explicit values like start override the inherited container alignment for that item only.

♿ Accessibility

  • Preserve reading order — moving one item visually does not change DOM order for screen readers.
  • Support RTL layouts — prefer start and end over hard-coded left/right values.
  • Keep touch targets usable — end-aligned badges and buttons still need adequate tap area.
  • Test zoom and reflow — centered or edge-aligned items should remain readable at larger text sizes.
  • Avoid overusing overrides — too many different alignments in one grid can confuse visual scanning.

🧠 How justify-self Works

1

Container sets the default

justify-items on the grid container defines inline-axis alignment for all items.

justify-items
2

Item size is resolved

The browser calculates each item’s inline size before placing it inside its grid area.

Sizing
3

justify-self overrides one item

When set to a keyword other than auto, the item ignores the container default for inline-axis placement.

Override
=

Flexible per-item alignment

One featured card, badge, or icon can stand out without changing alignment for the whole grid.

🖥 Browser Compatibility

justify-self is widely supported in modern browsers for CSS Grid layouts.

Baseline · CSS Grid

Reliable grid item alignment across browsers

Current Chrome, Firefox, Safari, Edge, and Opera all support justify-self on grid items.

97% Modern browser support
Google Chrome 57+
Full support
Mozilla Firefox 45+
Full support
Apple Safari 10.1+
Full support
Microsoft Edge 16+
Full support
Opera 44+
Full support
justify-self property 97% supported

Bottom line: Use justify-self confidently in modern CSS Grid layouts.

🎉 Conclusion

The justify-self property offers precise control over the inline-axis alignment of individual grid items inside their cells. Whether you need one featured card centered, a badge at the end, or a mix of start, center, and end in the same row, it provides clear keyword values for the job.

For beginners, set justify-items on the container first, then add justify-self only where an item needs to break the default. Remember to give items a width smaller than their cell so alignment changes are visible.

💡 Best Practices

✅ Do

  • Set justify-items on the container, then override with justify-self sparingly
  • Use start and end for writing-mode-friendly layouts
  • Give items width: fit-content or a fixed width when testing alignment
  • Pair with align-self when you need both axes customized for one item
  • Use auto when an item should follow the container default

❌ Don’t

  • Confuse justify-self with justify-items
  • Apply justify-self to the grid container instead of the item
  • Override every item when justify-items on the container is enough
  • Expect alignment to show when items already stretch to full cell width
  • Replace semantic structure with alignment tricks that harm readability

Key Takeaways

Knowledge Unlocked

Five things to remember about justify-self

Use these points when building CSS Grid layouts.

5
Core concepts
auto 02

Default

auto.

Values
center 03

Featured card

Highlight one tile.

Pattern
grid 04

Grid focus

Inline axis.

Scope
items 05

Not justify-items

Item vs container.

Compare

❓ Frequently Asked Questions

justify-self overrides the inline-axis alignment of a single grid item inside its grid area. It lets one item break away from the container's justify-items default.
The initial value is auto, which means the item follows the alignment set by the container's justify-items property.
justify-items sets the default inline-axis alignment for all grid items on the container. justify-self overrides that default for one specific item.
justify-self controls inline-axis alignment inside a grid cell. align-self controls block-axis alignment inside the same cell.
Use it when one grid item needs different horizontal placement than its neighbors, such as a featured card centered while others stay at the start.

Practice in the Live Editor

Open the HTML editor, set display: grid, and try different justify-self values on individual items.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful