Flexbox 與 Grid

自身對齊方式justify-self

Controlling how an individual item is aligned along its inline axis.

Overview

ClassDeclarations
justify-self:autojustify-self: auto;
justify-self:normaljustify-self: normal;
justify-self:baselinejustify-self: baseline;
justify-self:leftjustify-self: left;
justify-self:centerjustify-self: center;
justify-self:rightjustify-self: right;
justify-self:stretchjustify-self: stretch;
justify-self:startjustify-self: start;
justify-self:endjustify-self: end;
justify-self:flex-startjustify-self: flex-start;
justify-self:flex-endjustify-self: flex-end;
justify-self:self-startjustify-self: self-start;
justify-self:self-endjustify-self: self-end;
justify-self:<value>justify-self: <value>;

Examples

Align one grid item inline

Use justify-self:* to override inline-axis alignment for a single grid item.

<div class="grid">    <button class="justify-self:end">Save</button></div>
Generated CSS
@layer utilities {    .grid {        display: grid    }    .justify-self\:end {        justify-self: end    }}

Center an item inside its area

Use justify-self:center when the grid area is wider than the item.

<img class="justify-self:center" src="..." alt="" />

Use justify-items when every child should share the same inline alignment.

Apply conditionally

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

<div class="justify-self:stretch justify-self:end@sm justify-self:stretch@print">...</div>

For cross-axis item overrides, use align-self.


  • Master UI


© 2026 Aoyue Design LLC.MIT License
Trademark Policy