CKTIS / CSS
CSS-eigenschap `margin-inline-start`
`margin-inline-start` stelt de buitenmarge aan het logische begin van de inline-as in, toegewezen door schrijfmodus en tekstrichting.
Versie: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
<'margin-top'>margin-inline-start stelt de buitenmarge aan het logische begin van de inline-as in, toegewezen door schrijfmodus en tekstrichting.
In het voorbeeld koppelt horizontaal RTL het begin aan rechts: 10% van 200 px maakt 20 px ruimte tot de rechterrand. Verticaal LTR koppelt het aan boven en 10% van 100 px geeft 10 px; -6px trekt een item vóór de beginrand.
Grammatica: <'margin-top'>.
Een percentage gebruikt de inline-grootte van het omvattende blok en negatieve waarden zijn geldig. Een marge op de inline-as valt niet samen; het gedrag van auto hangt van het layoutalgoritme af.
Voorbeelden
<!doctype html><meta charset="utf-8"><div id="h"><i></i><i></i></div><div id="v"><i></i><i></i></div><div id="n"><i></i><i></i></div><pre id="result"></pre><script>
const setup=(box,css,value)=>{box.style.cssText='display:flex;'+css;for(const item of box.children)item.style.cssText='display:block;width:20px;height:20px';box.firstElementChild.style.marginInlineStart=value};setup(h,'direction:rtl;width:200px;height:30px','10%');setup(v,'writing-mode:vertical-rl;direction:ltr;width:30px;height:100px','10%');setup(n,'direction:ltr;width:100px;height:30px','-6px');const hp=h.getBoundingClientRect(),ha=h.firstElementChild.getBoundingClientRect(),vp=v.getBoundingClientRect(),va=v.firstElementChild.getBoundingClientRect(),np=n.getBoundingClientRect(),na=n.firstElementChild.getBoundingClientRect(),hs=getComputedStyle(h.firstElementChild),vs=getComputedStyle(v.firstElementChild);result.textContent='rtl-right-gap='+Math.round(hp.right-ha.right)+'; rtl-physical='+hs.marginRight+'; vertical-top-gap='+Math.round(va.top-vp.top)+'; vertical-physical='+vs.marginTop+'; negative-lead='+Math.round(na.left-np.left);
</script>Resultaat
rtl-right-gap=20; rtl-physical=20px; vertical-top-gap=10; vertical-physical=10px; negative-lead=-6
Het voorbeeld is lokaal uitgevoerd in een geïsoleerde Chrome-sessie zonder netwerk; het resultaat komt uit de CSS-API van de browser.