CKTIS / CSS
Vlastnosť CSS `left`
`left` nastavuje fyzický posun ľavého okraja polohovaného boxu voči obsahujúcemu bloku.
Verzia: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
auto | <length-percentage> | <anchor()> | <anchor-size()>left nastavuje fyzický posun ľavého okraja polohovaného boxu voči obsahujúcemu bloku.
Príklad porovná x absolútneho dieťaťa pred a po left:12px.
Gramatika: auto | <length-percentage> | <anchor()> | <anchor-size()>.
Na position:static nepôsobí a je fyzická; pre smer použite inset-inline-start. Preurčené left/right/width riešia pravidlá konfliktu.
Príklady
<!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="position:relative;width:100px;height:40px";x.style.cssText="position:absolute;width:20px;height:10px";const a=g.getBoundingClientRect(),x0=Math.round(x.getBoundingClientRect().left-a.left);x.style.left="12px";const x1=Math.round(x.getBoundingClientRect().left-a.left);document.querySelector("#result").textContent="child-x="+x0+"->"+x1+"; computed="+getComputedStyle(x).left;</script></body></html>Výsledok
child-x=0->12; computed=12px
Príklad bol spustený lokálne v izolovanej relácii Chrome bez siete; výsledok pochádza z CSS API prehliadača.