CKTIS / CSS
CSS property `margin-block`
`margin-block` is a shorthand for the block-start and block-end margins, whose physical sides come from the writing mode.
Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
<'margin-top'>{1,2}margin-block is a shorthand for the block-start and block-end margins, whose physical sides come from the writing mode.
The example uses writing-mode: vertical-rl: 10px 20px expands to a 10px physical right margin and a 20px left margin, while geometry confirms the right-edge gap.
Grammar: <'margin-top'>{1,2}.
One value sets both ends; two values mean block-start then block-end. Block-axis margins can collapse in normal block flow, whereas flex and grid item margins do not collapse.
Examples
<!doctype html><meta charset="utf-8"><div id="box"><i id="item"></i></div><pre id="result"></pre><script>
box.style.cssText='display:flex;writing-mode:vertical-rl;width:100px;height:60px;align-items:flex-start';item.style.cssText='display:block;width:20px;height:20px;margin-block:10px 20px';
const p=box.getBoundingClientRect(),a=item.getBoundingClientRect(),s=getComputedStyle(item);result.textContent='right-gap='+Math.round(p.right-a.right)+'; physical='+s.marginRight+' '+s.marginLeft+'; logical='+s.marginBlockStart+' '+s.marginBlockEnd;
</script>Result
right-gap=10; physical=10px 20px; logical=10px 20px
The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.