CKTIS / CSS
Lastnost CSS `justify-self`
`justify-self` poravna en element grid ali pozicionirano polje v območju na vrstični osi.
Različica: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Sintaksa
auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | anchor-centerjustify-self poravna en element grid ali pozicionirano polje v območju na vrstični osi.
Primer ohrani justify-items:start na vsebniku in premakne le preizkušenega otroka v center.
Slovnica: auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | anchor-center.
Ne poravna elementa flex na glavni osi; auto običajno sledi vsebniku, stretch pa zahteva samodejno mero.
Primeri
<!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>Rezultat
child-x=0->40; container=start; computed=center
Primer je bil izveden lokalno v izolirani seji Chrome brez omrežja; rezultat prihaja iz brskalnikovega API CSS.