Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `margin-bottom`

`margin-bottom` sets the box’s physical bottom margin regardless of writing mode.

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

Syntax

<length-percentage> | auto | <anchor-size()>

margin-bottom sets the box’s physical bottom margin regardless of writing mode.

The example runs under writing-mode: vertical-rl: margin-bottom: 12px creates a 12px vertical gap in the inline flow, while logical margin-block-end remains zero.

Grammar: <length-percentage> | auto | <anchor-size()>.

In this mode physical bottom corresponds to inline-end, not block-end. A bottom margin can collapse with an adjacent margin in normal block flow, but not between flex items.

Examples

<!doctype html><meta charset="utf-8"><div id="box"><i id="first"></i><i id="second"></i></div><pre id="result"></pre><script>
box.style.cssText='display:flex;writing-mode:vertical-rl;width:60px;height:100px';first.style.cssText='display:block;width:20px;height:20px;margin-bottom:12px';second.style.cssText='display:block;width:20px;height:20px';
const a=first.getBoundingClientRect(),b=second.getBoundingClientRect(),s=getComputedStyle(first);result.textContent='y-gap='+Math.round(b.top-a.bottom)+'; physical-bottom='+s.marginBottom+'; logical-block-end='+s.marginBlockEnd;
</script>

Result

y-gap=12; physical-bottom=12px; logical-block-end=0px

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

Sources