Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `margin-inline-start`

`margin-inline-start` sets the outer margin at the logical start of the inline axis, mapped by writing mode and text direction.

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

Syntax

<'margin-top'>

margin-inline-start sets the outer margin at the logical start of the inline axis, mapped by writing mode and text direction.

In the example, horizontal RTL maps the start to the right: 10% of 200px creates a 20px right-edge gap. Vertical LTR maps it to the top and 10% of 100px creates 10px; -6px pulls an item before the start edge.

Grammar: <'margin-top'>.

A percentage uses the containing block’s inline size, and negative values are valid. An inline-axis margin does not collapse; auto behavior depends on the layout algorithm.

Examples

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

Result

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

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources