CSS margin-block-start Property

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

What You’ll Learn

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

01

Block-Start

Start of block axis.

02

Logical

Writing-mode aware.

03

Longhand

One side only.

04

Offset

Space before items.

05

RTL safe

International layouts.

06

Default 0

No spacing.

Introduction

The margin-block-start property in CSS is used to set the margin at the start of an element’s block, depending on the writing mode, directionality, and text orientation.

This property is part of the logical properties and values, which are designed to work with different writing modes and text directions, such as left-to-right (LTR) or right-to-left (RTL).

Definition and Usage

Apply margin-block-start when you need spacing before an element on the block axis without affecting the block-end side. Common uses include offsetting content below a heading, adding space above a section, or creating rhythm in stacked layouts.

💡
Beginner Tip

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

📝 Syntax

The syntax for the margin-block-start property allows you to set a margin value in various units, such as pixels, ems, percentages, etc.

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

Here, value can be a length, percentage, or one of the global values like auto, inherit, initial, or unset.

Basic Example

margin-block-start.css
p {
  margin-block-start: 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-start: 20px;Fixed margin in px, em, rem, cm, pt, etc.
Percentagemargin-block-start: 5%;Margin as a percentage of the containing block width
automargin-block-start: auto;The browser calculates the margin
inheritmargin-block-start: inherit;Inherits the margin value from the parent element
initialmargin-block-start: initial;Sets the margin to its default value (0)
unsetmargin-block-start: unset;Resets the margin to its natural value
block-start

🎯 Default Value

The default value of the margin-block-start property is 0, meaning there is no margin applied by default at the start of the block. Override it when you need spacing before an element on the block axis.

👀 Live Preview

A note above a box with block-start margin:

Content above the box

margin-block-start: 1.25rem

Examples Gallery

Add block-start margin to a paragraph, offset sections below headings, see writing-mode behavior, and compare with physical margin-top.

🔢 Block-Start Spacing

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

Example 1 — Paragraph Block-Start Margin

In this example, we set a margin of 20 pixels at the start of the block for a paragraph element.

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

<h1>Example of margin-block-start</h1>
<p>This paragraph has a 20px margin at the start of the block.</p>
Try It Yourself

How It Works

In left-to-right horizontal writing, block-start maps to the top. The gap appears between the heading and this paragraph.

Example 2 — Section Offset Below Heading

Use block-start margin to push a section away from the heading above it.

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

How It Works

Block-start margin creates space before the section without adding margin on every side. This is a common pattern for heading-to-content rhythm.

📈 Writing Mode & Comparison

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

Example 3 — Writing Mode Adaptation

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

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

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

Horizontal writing

Content above
Block-start is above

Vertical writing

Block-start 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-start-compare.css
/* Logical */
.note {
  margin-block-start: 1.5rem;
}

/* Physical equivalent in horizontal LTR */
.note {
  margin-top: 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-startmargin-top
margin-block-endmargin-bottom
margin-inline-startmargin-left
margin-inline-endmargin-right

♿ Accessibility

  • Preserve reading order — Logical margins respect direction and writing mode, which helps RTL and multilingual users.
  • Maintain heading-to-content spacing — Block-start margin improves visual grouping without breaking semantics.
  • Avoid negative margins on focusable elements — Negative block-start margins can overlap previous interactive controls.
  • Test zoom and small screens — Large block-start margins can push content off-screen on narrow viewports.
  • Use semantic HTML — Margins adjust spacing; structure still comes from proper elements.

🧠 How margin-block-start Works

1

You set block-start spacing

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

CSS rule
2

Browser resolves block-start

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

Logical layout
3

Outer space is added

Transparent margin appears before the element on the block axis.

Box model
=

Clear offset

Content before the element stays separated on the block axis.

🖥 Browser Compatibility

The margin-block-start property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. As always, testing across different browsers ensures consistent behavior.

Modern browsers · Logical properties

Reliable in current browser versions

margin-block-start 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-start property 96% supported

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

🎉 Conclusion

The margin-block-start property is a useful tool for managing margins in a way that respects the writing mode and direction of the content.

It provides more flexibility and control over layout adjustments, especially in multilingual websites or applications. Experiment with different margin values to see how this property can enhance the spacing and layout of your web projects.

💡 Best Practices

✅ Do

  • Use margin-block-start for spacing below headings
  • Prefer rem for scalable block-start spacing
  • Pair with logical padding for consistent layouts
  • Test in RTL and vertical writing modes for international UIs
  • Combine with margin-block-end for full block-axis control

❌ Don’t

  • Assume block-start always means top 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-start

Use these points when spacing elements on the block-start 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-start property sets outer spacing on the block-start side of an element. In horizontal left-to-right writing, that is usually the top margin.
The default value is 0, meaning no block-start margin unless you set one explicitly.
margin-top always targets the physical top edge. margin-block-start 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-start when you only need spacing on the block-start side.
Use it for spacing before an element on the block axis, such as offset below a heading, space above a section, or gap before stacked content in multilingual layouts.

Practice in the Live Editor

Open the HTML editor, try different margin-block-start values, and see how block-start 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