CKTIS / CSS
Propiedad CSS `justify-self`
`justify-self` alinea un elemento grid o posicionado dentro de su área en el eje en línea.
Versión: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Sintaxis
auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | anchor-centerjustify-self alinea un elemento grid o posicionado dentro de su área en el eje en línea.
El ejemplo mantiene justify-items:start en el contenedor y mueve solo el hijo probado a center.
Gramática: auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | anchor-center.
No alinea un elemento flex en el eje principal; auto suele seguir al contenedor y stretch necesita tamaño auto.
Ejemplos
<!doctype html><html lang="en"><meta charset="utf-8"><title>CKTIS CSS example</title><body><pre id="result"></pre><script>const g=document.createElement("div"),x=document.createElement("i");document.body.prepend(g);g.append(x);g.style.cssText="display:grid;width:100px;height:40px;grid-template-columns:100px;justify-items:start";x.style.cssText="width:20px;height:10px";const a=g.getBoundingClientRect(),x0=Math.round(x.getBoundingClientRect().left-a.left);x.style.justifySelf="center";const x1=Math.round(x.getBoundingClientRect().left-a.left);document.querySelector("#result").textContent="child-x="+x0+"->"+x1+"; container="+getComputedStyle(g).justifyItems+"; computed="+getComputedStyle(x).justifySelf;</script></body></html>Resultado
child-x=0->40; container=start; computed=center
El ejemplo se ejecutó localmente en una sesión aislada de Chrome sin red; el resultado procede de la API CSS del navegador.