Flexbox 與 Grid

自身位置place-self

Setting align-self and justify-self at the same time.

Overview

ClassDeclarations
place-self:autoplace-self: auto;
place-self:normalplace-self: normal;
place-self:baselineplace-self: baseline;
place-self:centerplace-self: center;
place-self:stretchplace-self: stretch;
place-self:startplace-self: start;
place-self:endplace-self: end;
place-self:flex-startplace-self: flex-start;
place-self:flex-endplace-self: flex-end;
place-self:self-startplace-self: self-start;
place-self:self-endplace-self: self-end;
place-self:<align-self>|<justify-self>place-self: <align-self> <justify-self>;

Examples

Align one item on both axes

Use place-self:* as shorthand for align-self and justify-self.

<div class="grid h:48x">    <button class="place-self:end">Save</button></div>
Generated CSS
@layer utilities {    .grid {        display: grid    }    .place-self\:end {        place-self: end    }    .h\:48x {        height: 12rem    }}

Center one item

Use place-self:center when one grid item should sit in the middle of its grid area.

<div class="place-self:center">...</div>

Use place-items when every child should share the same two-axis alignment.

Apply conditionally

Apply styles based on different states using selectors and conditional queries.

<div class="place-self:auto place-self:center@sm place-self:auto@print">...</div>

The effect depends on the parent layout mode and available space in the item area.


  • Master UI


© 2026 Aoyue Design LLC.MIT License
Trademark Policy