CSS margin-block-end Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The margin-block-end property sets the outer margin on the block-end edge of an element. In a horizontal writing mode (the usual default), that maps to the physical bottom — like margin-bottom.

With a vertical writing-mode, it can map to left or right instead. It is one half of the margin-block shorthand (with margin-block-start). It is not inherited. The initial value is 0.

Baseline · Widely available.

Not deprecated. Cross-browser since about January 2020. Prefer it over margin-bottom when writing mode may change.

Logical tip.

Use margin-block-end for space after the element in the writing flow. Pair with margin-block-start when you need both sides separately.

CSS Syntax

syntax.css
margin-block-end: <length> | <percentage> | auto | initial | inherit;

Same value types as margin-top / margin-bottom, but the side is logical.

Property Values

ValueDescriptionTry it
<length>Fixed size such as 1rem or 20pxTry it
<percentage>Percent of the containing block (layout-dependent, often its width)Try it
autoBrowser chooses the block-end marginTry it
With writing-modeShows how block-end maps when text flows verticallyTry it
initialResets to 0Try it
inheritInherits from the parent elementTry it

How to Use margin-block-end

Think “space after this box in the writing flow,” not always “bottom.”

  1. Decide how much gap you want after the element on the block axis.
  2. Set margin-block-end with a length, percentage, or auto.
  3. Use margin-block-start if you also need space before the element.
  4. Test with writing-mode if orientation may change.
In horizontal-tbUsually maps to
margin-block-endmargin-bottom
margin-block-end: 1remLike margin-bottom: 1rem

Live Preview

The middle (amber) box is the target. Change margin-block-end in a horizontal writing mode.

In this preview, block-end is the bottom edge.

Boxes
Above
Target
Below

margin-block-end: 0

CSS Examples

Each snippet shows only margin-block-end (plus writing-mode when needed). Use Try It Yourself for a live editor.

Example 1 — Length Value

A fixed length adds space after the box on the block axis.

CSS
<style>
  .box {
    margin-block-end: 1rem;
  }
</style>

<div class="box">Target</div>
Try It Yourself

How It Works

  1. One side only. margin-block-end: 1rem affects the block-end edge.
  2. Horizontal default. That usually means the bottom gets 1rem.
  3. Neighbor moves. The next box sits farther away after the target.
  4. Start unchanged. Block-start (often top) stays at its previous value.

Example 2 — Percentage

A percentage sizes the block-end margin relative to the containing block.

CSS
<style>
  .box {
    margin-block-end: 5%;
  }
</style>

<div class="box">Target</div>
Try It Yourself

How It Works

  1. Percent, not height. The percentage is layout-dependent (often based on containing-block width).
  2. Still block-end. Only the end edge receives that spacing.
  3. Scales with container. Wider parents can produce a larger gap.
  4. Prefer rem/px when you need a predictable fixed gap.

Example 3 — Vertical Writing Mode

Block-end follows the writing mode, not always the physical bottom.

CSS
<style>
  .stack {
    writing-mode: vertical-rl;
  }

  .box {
    margin-block-end: 1rem;
  }
</style>

<div class="stack">
  <div class="box">Target</div>
</div>
Try It Yourself

How It Works

  1. Change the flow. writing-mode: vertical-rl makes lines run vertically.
  2. Keep logical margin. margin-block-end still means the end of the block axis.
  3. Physical side changes. The gap may appear on left/right instead of bottom.
  4. Why it matters. One rule stays correct when orientation changes.

Edge Cases & Pitfalls

Logical “end” is easy to mix up with physical bottom.

mapping

Not always the bottom

In vertical writing modes, block-end can map to physical left or right. Check writing-mode before debugging.

collapse

Block margins can still collapse

In normal flow, adjacent block-axis margins may collapse just like classic top/bottom margins.

shorthand

Physical margin can override

A later margin shorthand sets all four physical sides and can wipe this longhand depending on cascade order.

pair

Only one edge

margin-block-end does not set block-start. Use margin-block-start or the margin-block shorthand for both.

Browser Support

margin-block-end is a browser CSS property (logical box model). Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

margin-block-end

Supported in modern browsers since about January 2020. Part of CSS Logical Properties and Values.

96% Modern support
Google Chrome 69+
Full support
Mozilla Firefox 41+
Full support
Apple Safari 12.1+
Full support
Microsoft Edge 79+
Full support
Opera 56+
Full support
Samsung Internet 10+
Full support
Internet Explorer —
No support
margin-block-end Modern browsers

Bottom line: Safe for modern sites. Fall back to margin-bottom only if you must support Internet Explorer. It is not a runtime API.

Key Takeaways

  • Role: outer margin on the block-end edge only.
  • Logical: follows writing mode — usually bottom in horizontal text.
  • Shorthand: part of margin-block with margin-block-start.
  • Default: 0 — not inherited.

One line: margin-block-end adds space after the element on the block axis — writing-mode aware.

Frequently Asked Questions

It sets the outer margin on the block-end edge. In a horizontal writing mode, that is usually the bottom. The physical side can change with writing-mode.
The default is 0, so there is no block-end margin until you set one.
margin-bottom always means physical bottom. margin-block-end follows writing mode, so in vertical text it may map to left or right instead.
margin-block is the shorthand for margin-block-start and margin-block-end. Use the longhand when you only need the end side.
Use it for spacing after an element on the block axis—between stacked sections or paragraphs—especially when writing mode may change.
It is Baseline and widely available in modern browsers since about January 2020. It is a browser CSS property, not a Node.js feature.

Next: margin-block-start

Learn the longhand for the block-start outer margin.

margin-block-start tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful