WissensdatenbankPrüfungszentrum
DEDeutsch
Sprache wählen13

CKTIS / CSS

CSS-Eigenschaft `margin-inline-start`

`margin-inline-start` setzt den Außenrand am logischen Anfang der Inline-Achse, den Schreibmodus und Textrichtung zuordnen.

Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review

Syntax

<'margin-top'>

margin-inline-start setzt den Außenrand am logischen Anfang der Inline-Achse, den Schreibmodus und Textrichtung zuordnen.

Im Beispiel ordnet horizontales RTL den Anfang rechts zu: 10% von 200 px ergeben 20 px Abstand zur rechten Kante. Vertikales LTR ordnet ihn oben zu und 10% von 100 px ergeben 10 px; -6px zieht ein Element vor die Startkante.

Grammatik: <'margin-top'>.

Prozentwerte beziehen sich auf die Inline-Größe des umschließenden Blocks, und negative Werte sind gültig. Ein Inline-Achsenrand kollabiert nicht; das Verhalten von auto hängt vom Layoutalgorithmus ab.

Beispiele

<!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>

Ergebnis

rtl-right-gap=20; rtl-physical=20px; vertical-top-gap=10; vertical-physical=10px; negative-lead=-6

Das Beispiel lief lokal in einer isolierten Chrome-Sitzung ohne Netzwerk; das Ergebnis stammt aus der CSS-API des Browsers.

Quellen