CSS padding-block Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Logical CSS & Box Model

What You’ll Learn

The padding-block property is a logical CSS shorthand for inner spacing on the block-start and block-end sides of an element. In normal horizontal English layouts, that usually means the top and bottom padding.

01

Logical Padding

Block-start and block-end.

02

Shorthand

One or two values.

03

One Value

Same padding both sides.

04

Two Values

Start then end.

05

Writing Modes

Adapts to text flow.

06

padding

Physical shorthand pair.

Introduction

The padding-block property in CSS is a shorthand property that sets the padding area on the block start and block end sides of an element. In languages written horizontally, such as English, these correspond to the top and bottom padding.

This property is part of the CSS Logical Properties and Values specification, which provides a way to define properties in a writing-mode-independent manner.

Definition and Usage

Apply padding-block when you need vertical inner spacing that follows the block axis instead of fixed physical top and bottom edges. Use a single value for equal block-start and block-end padding, or two values when each side needs a different amount.

Like regular padding, padding-block increases the visible size of an element’s background and border box. It never collapses and always stays inside the element’s border.

💡
Beginner Tip

For a simple horizontal page, padding-block: 20px 40px; looks like 20px top padding and 40px bottom padding. The advantage appears when writing mode changes and physical top/bottom rules would no longer be correct.

Horizontal writing → top and bottom Vertical writing → left and right

📝 Syntax

The syntax for the padding-block property allows you to specify one or two values:

syntax.css
element {

  padding-block: value;

}
  • One value — The same padding is applied to both the block start and block end.
  • Two values — The first value is applied to the block start, and the second value is applied to the block end.

Basic Example

padding-block.css
.example {

  padding-block: 20px 40px;

  background-color: lightblue;

}

⚡ Quick Reference

QuestionAnswer
Initial value0
Applies toBlock-start and block-end padding sides
InheritedNo
AnimatableYes, as a length
Common useSections, cards, text blocks, and writing-mode-aware vertical spacing

🎯 Default Value

The default value of the padding-block property is 0, meaning no padding is applied.

💎 Property Values

ValueExampleDescription
Lengthpadding-block: 20px 40px;A specific length value, such as 10px, 1em, 2rem, etc.
Percentagepadding-block: 5%;A percentage of the containing block’s inline size, such as 10%.
autoNot applicable.
initialpadding-block: initial;Sets the property to its default value.
inheritpadding-block: inherit;Inherits the property value from its parent element.
padding-block: 24px; padding-block: 20px 40px; padding-block-start: 1rem;

👀 Live Preview

Four boxes with the same content and different pblk- utility classes showing increasing block-axis inner spacing:

pblk-sm
pblk-md
pblk-lg
pblk-xl

Examples Gallery

Try the reference example with two values, a single-value form, section vertical spacing, and a logical vs physical padding comparison.

🔢 Basic padding-block

Start with the reference example — different padding on block-start and block-end.

Example 1 — Block-Start and Block-End Padding

In this example, we’ll add padding to the block start and block end sides of a <div> element.

padding-block-example.html
<style>

  .example {

    padding-block: 20px 40px;

    background-color: lightblue;

  }

</style>



<div class="example">

  This div has 20px padding at the block start and 40px at the block end.

</div>
Try It Yourself

How It Works

The lightblue background fills the padding area, so you can see 20px space at block-start and 40px at block-end. In horizontal English, that is top and bottom padding.

Example 2 — Single Value

Set equal block-start and block-end padding with padding-block: 24px.

padding-block-single.css
.note {

  padding-block: 24px;

  background: #fff;

  border: 1px solid #e2e8f0;

  border-radius: 0.5rem;

}
Try It Yourself

How It Works

With one value, both block sides receive the same padding. This is a common pattern for evenly spaced text blocks and alerts.

🛠 Layout Patterns

Apply block-axis padding to real components and compare logical vs physical properties.

Example 3 — Section Vertical Spacing

Use padding-block with padding-inline for comfortable card and section spacing.

padding-block-section.css
.section {

  padding-block: 1.5rem;

  padding-inline: 1.25rem;

  background: #fff;

  border: 1px solid #e2e8f0;

  border-radius: 0.75rem;

}
Try It Yourself

How It Works

Pair padding-block for vertical rhythm with padding-inline for horizontal rhythm. Together they replace physical padding shorthand in logical layouts.

Example 4 — Logical vs Physical Padding

Compare padding-block with padding-top and padding-bottom.

padding-block-logical.css
/* Logical — follows writing mode */

.logical {

  padding-block: 16px 32px;

}



/* Physical — fixed to top and bottom */

.physical {

  padding-top: 16px;

  padding-bottom: 32px;

}
Try It Yourself

How It Works

In horizontal English, both approaches look the same. padding-block stays correct when writing mode changes; physical top and bottom padding does not.

padding-block vs padding, padding-inline & side properties

The padding shorthand sets all four sides at once using physical edges. Use padding for simple layouts that always use horizontal writing.

padding-inline controls inline-start and inline-end padding (usually left and right in English). When you need per-edge block-axis control, use padding-block-start, padding-block-end, or the longhand pair padding-top and padding-bottom.

padding-block-companion.css
/* Logical block-axis spacing */

.card {

  padding-block: 1.25rem;

  padding-inline: 1rem;

}



/* Physical fallback for older browsers */

.legacy-card {

  padding-top: 1.25rem;

  padding-bottom: 1.25rem;

}

♿ Accessibility

  • Improve readability — Text blocks benefit from block-axis padding so lines do not touch container edges.
  • Size touch targets — Pair block padding with inline padding on buttons and links for comfortable tap areas.
  • Respect writing modes — Logical padding keeps spacing correct for users of vertical or RTL layouts.
  • Do not hide content — Very large block padding on small screens can push important content out of view.
  • Test zoomed layouts — Users who zoom in rely on comfortable padding to keep text readable.

🧠 How padding-block Works

1

The browser finds block-start and block-end

Writing mode decides which physical edges are block-start and block-end.

Writing mode
2

You set one or two padding values

Write padding-block: 20px 40px; or a single value for both sides.

CSS rule
3

Browser adds space on block sides

Padding is inserted between the content edge and the border on block-start and block-end.

Box model
=

Adaptable block-axis spacing

Your layout keeps correct vertical spacing when writing mode changes.

Browser Compatibility

The padding-block property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always advisable to test your website across different browsers to ensure compatibility, especially if your audience includes users of older browsers.

Baseline · Modern browsers

Logical padding in today’s browsers

Chrome, Firefox, Safari, Edge, and Opera support padding-block in current versions.

96% Modern browser support
Google Chrome 69+ · Desktop & Mobile
Full support
Mozilla Firefox 41+ · Desktop & Mobile
Full support
Apple Safari 12.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 56+ · Modern versions
Full support
padding-block property 96% supported

Bottom line: Use padding-block confidently in modern projects. For older browsers, fall back to padding-top and padding-bottom.

Conclusion

The padding-block property provides a convenient way to control the padding on the block start and block end sides of an element, respecting the writing mode of the document.

This property helps create more flexible and responsive designs by adjusting the layout based on the writing direction. Experiment with different padding values to see how they can enhance the visual structure of your web content.

💡 Best Practices

✅ Do

  • Use padding-block for vertical rhythm in logical layouts
  • Pair with padding-inline for full logical spacing
  • Prefer rem or em for scalable block-axis spacing
  • Use two values when block-start and block-end need different amounts
  • Test in vertical writing mode for international layouts

❌ Don’t

  • Confuse padding-block with margin-block
  • Assume padding-block always means top and bottom in every writing mode
  • Forget that percentage padding is based on inline size
  • Mix logical and physical padding on the same element without reason
  • Skip fallbacks when supporting very old browsers

Key Takeaways

Knowledge Unlocked

Five things to remember about padding-block

Use these points when spacing content along the block axis.

5
Core concepts
0 02

Default 0

No spacing.

Default
1|2 03

Shorthand

One or two values.

Syntax
% 04

Units

px, em, rem, %.

Values
wm 05

Writing mode

Adapts logically.

Logical CSS

❓ Frequently Asked Questions

The padding-block property is a shorthand that sets padding on the block-start and block-end sides of an element. In horizontal writing, those are usually the top and bottom padding.
The default value is 0, meaning no block-axis inner spacing is applied unless you set padding-block explicitly.
padding-top and padding-bottom always target physical top and bottom edges. padding-block follows the writing mode, so it stays correct when text direction or writing mode changes.
Yes. With two values, the first applies to block-start and the second to block-end. With one value, both sides use the same padding.
Use padding-block when building layouts that may use vertical writing modes, multilingual content, or logical CSS systems that pair with properties like inline-size and block-size.

Practice in the Live Editor

Open the HTML editor, try different padding-block values, and see how block-axis spacing changes your layout instantly.

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