CKTIS / CSS
Vlastnost CSS `left`
`left` nastavuje fyzický posun levého okraje polohovaného boxu vůči obsahujícímu bloku.
Verze: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntaxe
auto | <length-percentage> | <anchor()> | <anchor-size()>left nastavuje fyzický posun levého okraje polohovaného boxu vůči obsahujícímu bloku.
Příklad porovná x absolutního dítěte před a po left:12px.
Gramatika: auto | <length-percentage> | <anchor()> | <anchor-size()>.
Na position:static nepůsobí a je fyzická; pro směr použijte inset-inline-start. Přeurčené left/right/width řeší pravidla konfliktu.
Pří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ýsledek
child-x=0->12; computed=12px
Příklad byl spuštěn místně v izolované relaci Chrome bez sítě; výsledek pochází z CSS API prohlížeče.