CSS Portal

CSS padding-block Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The padding-block property is a logical shorthand that controls the inner spacing on an element along the block axis — that is, it sets padding on both the block-start and block-end edges relative to the current writing mode. Because it follows the flow of the document rather than fixed physical sides, the edges it affects can correspond to top/bottom in horizontal writing modes or left/right in vertical writing modes; this makes it especially useful for internationalized layouts where the block direction can change.

Using padding-block helps keep styles concise and resilient: instead of separately setting physical paddings like top and bottom, you can express intent in terms of flow. It pairs naturally with logical-inline controls to fully define an element’s internal spacing; for example, you can combine it with padding-inline to cover both the block and inline axes, or fall back to the more general padding shorthand when you want a single declaration to cover all sides.

Because padding is part of the element’s box model, changing padding-block alters the distance between an element’s border and its content and can influence layout and alignment of child content. Unlike margins, padding does not collapse with adjacent elements, so increasing block padding reliably adds internal space rather than creating the sometimes-surprising effects you can see with margin collapse. The exact direction that counts as “block start” or “block end” depends on layout properties such as writing-mode, so logical padding keeps your stylesheet behaviors consistent across different text orientations.

In practice, prefer padding-block in components and responsive layouts where the relationship to the document flow matters: it reduces duplicate declarations when supporting multiple writing modes and prevents errors when swapping between horizontal and vertical text. Because it is not inherited, you’ll typically set it directly on the element that needs the internal spacing, and combine it with logical margin or inline padding rules when building robust, locale-aware UI components.

Definition

Initial value
See individual properties
Applies to
all elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
Inherited
no
Computed value
all elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
Animatable
a length
JavaScript syntax
object.style.paddingBlock

Interactive Demo

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass.

Syntax

padding-block: <padding-top>{1,2}  

Values

  • <padding-top>{1,2}Specifies padding-block in px, pt, cm, etc. Negative values are not allowed.

Example

<main>
<h1>padding-block examples</h1>
<div class="example normal">
<strong>Normal flow</strong>
<p>padding-block: 2rem;</p>
</div>
<div class="example small">
<strong>Smaller padding</strong>
<p>padding-block: 0.5rem;</p>
</div>
<div class="example vertical">
<strong>Vertical writing-mode</strong>
<p>writing-mode: vertical-rl; padding-block: 1.5rem;</p>
</div>
</main>
*:not(svg) {
    box-sizing: border-box;
}

main {
    max-width: 720px;
    margin: 2rem auto;
    padding-inline: 1rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

h1 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.example {
    background: #e6f7ff;
    border: 1px solid #cceeff;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding-inline: 1rem;
}

.example.normal {
    padding-block: 2rem;
}

.example.small {
    padding-block: 0.5rem;
}

.example.vertical {
    writing-mode: vertical-rl;
    padding-block: 1.5rem;
    height: 8rem;
    display: inline-block;
}

strong {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

p {
    margin: 0;
}

Browser Support

The following information will show you the current browser support for the CSS padding-block property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!