CSS margin-block-end Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Layout & Logical Properties

What You’ll Learn

The margin-block-end property sets outer spacing on the block-end side of an element using logical layout instead of physical bottom margin.

01

Block-End

End of block axis.

02

Logical

Writing-mode aware.

03

Longhand

One side only.

04

Stack spacing

Gap after items.

05

RTL safe

International layouts.

06

Default 0

No spacing.

Introduction

The margin-block-end property in CSS is part of the logical properties and values module, which allows for writing CSS in a way that is more consistent across different writing modes, such as left-to-right, right-to-left, and vertical text.

This property sets the margin at the end of the block axis, which can be at the bottom or top of the element, depending on the writing mode.

Definition and Usage

Apply margin-block-end when you need spacing after an element on the block axis without affecting the block-start side. Common uses include separating stacked cards, paragraphs, form fields, and section blocks.

💡
Beginner Tip

In normal horizontal English pages, margin-block-end: 20px behaves like margin-bottom: 20px. The advantage appears when writing mode or direction changes.

📝 Syntax

The syntax for the margin-block-end property is simple. It can accept a variety of length units or keywords to define the margin size.

syntax.css
element {
  margin-block-end: value;
}

Basic Example

margin-block-end.css
p {
  margin-block-end: 20px;
}

⚡ Quick Reference

QuestionAnswer
Initial value0
Applies toAll elements except table display types that use separate border model
InheritedNo
AnimatableYes, as a length
Related shorthandmargin-block

💎 Property Values

ValueExampleMeaning
Lengthmargin-block-end: 20px;Fixed margin using px, em, rem, etc.
Percentagemargin-block-end: 5%;Margin as a percentage of the containing block width
automargin-block-end: auto;The browser calculates the margin automatically
initialmargin-block-end: initial;Sets the property to its default value (0)
inheritmargin-block-end: inherit;Inherits the property value from the parent element
block-end

🎯 Default Value

The default value for margin-block-end is 0, meaning no margin is applied by default. Override it when you need spacing after an element on the block axis.

👀 Live Preview

A box with block-end margin above a note element:

margin-block-end: 1.25rem

Space appears after the blue box on the block axis.

Examples Gallery

Add block-end margin to a paragraph, space stacked cards, see writing-mode behavior, and compare with physical margin-bottom.

🔢 Block-End Spacing

Start with the reference example — add margin at the end of the block axis on a paragraph.

Example 1 — Paragraph Block-End Margin

Set a margin at the end of the block axis for a paragraph. Depending on the writing mode, this margin could appear at the bottom or top of the paragraph.

margin-block-end.html
<style>
  p {
    margin-block-end: 20px;
  }
</style>

<p>This paragraph has a margin block end of 20px.</p>
<p>The next paragraph follows after the block-end gap.</p>
Try It Yourself

How It Works

In left-to-right horizontal writing, block-end maps to the bottom. The gap appears between this paragraph and the next element.

Example 2 — Stacked Cards

Use block-end margin to separate stacked UI cards without adding margin on every side.

margin-block-end-stack.css
.card {
  margin-block-end: 1rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}
Try It Yourself

How It Works

Block-end margin creates vertical rhythm in a stack. Only the trailing side gets spacing, which is cleaner than uniform margin on all sides.

📈 Writing Mode & Comparison

See why logical block-end margins matter when text flow changes, and how they relate to physical margins.

Example 3 — Writing Mode Adaptation

The same margin-block-end rule follows the block axis when writing mode changes.

margin-block-end-writing.css
.box {
  margin-block-end: 1rem;
  padding: 0.75rem;
  background: #eff6ff;
}

.vertical {
  writing-mode: vertical-rl;
}

Horizontal writing

Block-end is below
Next content

Vertical writing

Block-end shifts
Try It Yourself

How It Works

Logical properties follow the block axis, not fixed screen directions. That keeps spacing predictable in international layouts.

Example 4 — Logical vs Physical

In horizontal LTR writing, these two rules produce the same visual result:

margin-block-end-compare.css
/* Logical */
.note {
  margin-block-end: 1.5rem;
}

/* Physical equivalent in horizontal LTR */
.note {
  margin-bottom: 1.5rem;
}
Try It Yourself

How It Works

Choose logical properties when layouts must adapt to writing mode. Physical margins are fine for simple single-language pages.

Logical vs Physical Margins

LogicalPhysical (horizontal LTR)
margin-block-endmargin-bottom
margin-block-startmargin-top
margin-inline-endmargin-right
margin-inline-startmargin-left

♿ Accessibility

  • Preserve reading order — Logical margins respect direction and writing mode, which helps RTL and multilingual users.
  • Maintain section separation — Block-end margin improves visual grouping between content blocks.
  • Avoid negative margins on focusable elements — Negative block-end margins can overlap the next interactive control.
  • Test zoom and small screens — Large block-end margins can push content off-screen on narrow viewports.
  • Use semantic HTML — Margins adjust spacing; structure still comes from proper elements.

🧠 How margin-block-end Works

1

You set block-end spacing

Apply margin-block-end with a length, percentage, or keyword.

CSS rule
2

Browser resolves block-end

The block-end side is determined by writing mode and text direction.

Logical layout
3

Outer space is added

Transparent margin appears after the element on the block axis.

Box model
=

Clear separation

Content after the element is pushed away on the block axis.

🖥 Browser Compatibility

The margin-block-end property is widely supported in modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it’s always advisable to test your website across different browsers and devices to ensure full compatibility.

Modern browsers · Logical properties

Reliable in current browser versions

margin-block-end is part of the CSS Logical Properties module. Use it in modern projects; provide physical fallbacks only if you must support very old browsers.

96% Global browser support
Google Chrome 87+ · Desktop & Mobile
Full support
Mozilla Firefox 66+ · Desktop & Mobile
Full support
Apple Safari 14.1+ · macOS & iOS
Full support
Microsoft Edge 87+ · Chromium
Full support
Opera 73+ · Modern
Full support
margin-block-end property 96% supported

Bottom line: Safe for modern sites. For block-start spacing, see margin-block-start.

🎉 Conclusion

The margin-block-end property is a versatile tool for web developers looking to manage margins in a logical and writing-mode-aware manner.

This property is particularly useful in internationalized websites, where text direction can vary significantly. By using logical properties like margin-block-end, you can ensure your layouts remain consistent and accessible across different writing systems.

💡 Best Practices

✅ Do

  • Use margin-block-end for spacing between stacked sections
  • Prefer rem for scalable block-end spacing
  • Pair with logical padding for consistent layouts
  • Test in RTL and vertical writing modes for international UIs
  • Use with semantic block elements like sections and articles

❌ Don’t

  • Assume block-end always means bottom in every layout
  • Mix logical and physical margins on the same axis without reason
  • Use huge fixed margins that break mobile layouts
  • Forget margin collapse between stacked block elements
  • Skip browser testing for older Safari versions

Key Takeaways

Knowledge Unlocked

Five things to remember about margin-block-end

Use these points when spacing elements on the block-end side.

5
Core concepts
0 02

Default 0

No spacing.

Default
LH 03

Longhand

One side.

Type
wm 04

Writing mode

Adapts flow.

Logical
i18n 05

RTL safe

Global layouts.

Use case

❓ Frequently Asked Questions

The margin-block-end property sets outer spacing on the block-end side of an element. In horizontal left-to-right writing, that is usually the bottom margin.
The default value is 0, meaning no block-end margin unless you set one explicitly.
margin-bottom always targets the physical bottom edge. margin-block-end follows the writing mode, so spacing stays correct when text flow or direction changes.
margin-block is shorthand for margin-block-start and margin-block-end. Use margin-block-end when you only need spacing on the block-end side.
Use it for spacing after an element on the block axis, such as gap between stacked sections, cards, or paragraphs in multilingual layouts.

Practice in the Live Editor

Open the HTML editor, try different margin-block-end values, and see how block-end spacing changes your layout.

HTML Editor →

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.

5 people found this page helpful