CKTIS / CSS
CSS property `place-self`
`place-self` sets one box’s self-alignment within its container: the first value expands to `align-self`, and the optional second expands to `justify-self`.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<'align-self'> <'justify-self'>?place-self sets one box’s self-alignment within its container: the first value expands to align-self, and the optional second expands to justify-self.
The example keeps the container’s default alignment at start and overrides two items: end center moves the first to the block-axis end and inline-axis center, one center centers the second on both axes, and a third retains auto.
Grammar: <'align-self'> <'justify-self'>?.
An omitted second value is copied from the first. The computed keyword remains auto. It normally behaves as the parent’s corresponding computed align-items or justify-items value, without legacy; this also applies when determining an absolutely positioned box’s static position. With no parent, or when determining that box’s actual absolute position, it behaves as normal. In flex layout justify-self does not move an item on the main axis, and auto margins can absorb free space and override alignment.
Examples
<!doctype html><meta charset="utf-8"><style>html,body{margin:0}.grid{position:absolute;top:0;width:200px;height:120px;display:grid;grid-template:120px/200px;place-items:start}.grid i{width:40px;height:20px}</style><div id="pair" class="grid" style="left:0"><i style="place-self:end center"></i></div><div id="single" class="grid" style="left:300px"><i style="place-self:center"></i></div><div id="baseline" class="grid" style="left:600px"><i></i></div><pre id="result"></pre><script>const item=box=>box.firstElementChild,offset=box=>{const a=box.getBoundingClientRect(),b=item(box).getBoundingClientRect();return[Math.round(b.left-a.left),Math.round(b.top-a.top)]},a=offset(pair),b=offset(single),c=offset(baseline),x=getComputedStyle(item(pair)),y=getComputedStyle(item(single)),z=getComputedStyle(item(baseline));if(a.join(',')!=='80,100'||b.join(',')!=='80,50'||c.join(',')!=='0,0'||x.alignSelf!=='end'||x.justifySelf!=='center'||y.alignSelf!=='center'||y.justifySelf!=='center'||z.alignSelf!=='auto'||z.justifySelf!=='auto')throw new Error('place-self mismatch');result.textContent='pair='+a.join(',')+' '+x.alignSelf+'/'+x.justifySelf+'; single='+b.join(',')+' '+y.alignSelf+'/'+y.justifySelf+'; auto='+c.join(',')+' '+z.alignSelf+'/'+z.justifySelf;</script>Result
pair=80,100 end/center; single=80,50 center/center; auto=0,0 auto/auto
The example keeps the container’s default alignment at start and overrides two items: `end center` moves the first to the block-axis end and inline-axis center, one `center` centers the second on both axes, and a third retains `auto`.