π― place-self β Shorthand for Aligning Individual Grid Items
π What is place-self?
place-self is a CSS Grid (and Flexbox) item-level shorthand property that sets bothalign-self (vertical alignment) andjustify-self (horizontal alignment) for a single grid item β all in one line.
>>βplace-self = align-self + justify-self β the fastest way to align a single grid item.β
π Why use place-self?
- Align one grid item differently from others
- Write cleaner, shorter CSS
- Control vertical + horizontal alignment together
- Override container-level alignment rules easily
π― Syntax
place-self Syntax
place-self: <align-self> <justify-self>;If you provide only **one value**, it applies to both align-self AND justify-self.
π― Available Values
| Value | Effect |
|---|---|
| start | Aligns item to top/left |
| center | Centers item vertically/horizontally |
| end | Aligns item to bottom/right |
| stretch | Stretches item to fill available space |
π§ͺ Basic Example β Perfect Centering
Center a Single Grid Item
.container {
display: grid;
place-items: start; /* default for all items */
}
.item2 {
place-self: center;
/* Same as: align-self: center; justify-self: center; */
}Only .item2 becomes fully centered in its cell.
π Visual Example

π§± Two-Value Example
Different Vertical & Horizontal Alignment
/* place-self: align-self justify-self */ */
.item {
place-self: start end;
/* vertical β start (top), horizontal β end (right) */
}β‘ Equivalent Longhand
Longhand Equivalent
place-self: center;
/* same as */
align-self: center;
justify-self: center;π§ place-self vs place-items
| Property | Aligns What? |
|---|---|
| place-self | One grid item |
| place-items | All grid items |
Note
π‘ Use place-self when *one* item needs unique alignment. Use place-items for global alignment.
π§© Practical Use Cases
- Centering a specific icon inside a grid card
- Aligning a CTA button to bottom-right inside a layout
- Positioning labels or badges precisely
- Overriding the uniform alignment of other items
π§ͺ Example: Bottom-Right Badge Placement
Precise Badge Alignment
.product {
display: grid;
}
.badge {
place-self: end end; /* bottom-right */
}π± Responsive Example
Responsive place-self
.hero-text {
place-self: center; /* centered on small screens */
}
@media (min-width: 768px) {
.hero-text {
place-self: start center; /* top & centered on bigger screens */
}
}Fully centered on mobile β Top-centered on larger screens.
β οΈ Common Mistakes
- Using place-self on non-grid children (wonβt work)
- Expecting horizontal alignment to change with align-self (must use justify-self or place-self)
- Forgetting the difference between items and content alignment
- Stretch issues when item has fixed width/height
Note
π§ Quick Alignment Map:
β’ align-self β vertical
β’ justify-self β horizontal
β’ place-self β both (shorthand)
β’ align-self β vertical
β’ justify-self β horizontal
β’ place-self β both (shorthand)
π₯ Summary
place-self is the simplest way to precisely position a single grid item both vertically and horizontally. It replaces two separate properties, making your CSS cleaner and faster to write.
>>βWith place-self, aligning one item becomes effortless β just one line, perfect control.β
Learn more:MDN Docs π