CSS border-block Property

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

Definition and Usage

The border-block property is a logical shorthand that sets border-block-width, border-block-style, and border-block-color on both the block-start and block-end sides at once.

In the default horizontal writing mode, that means top and bottom. Change writing-mode, and the same rule can map to the left and right edges instead. For the other axis, use border-inline.

Baseline · Widely available.

Not deprecated and not experimental. Logical border shorthands have been widely available across browsers since 2021.

CSS Syntax

syntax.css
border-block: <line-width> || <line-style> || <color> | initial | inherit;

Same value shape as border, but only for the block axis. One declaration styles both block sides the same way.

Property Values

ValueDescriptionTry it
<line-width>Thickness on both block sides. Default mediumTry it
solidContinuous line on block-start and block-endTry it
dashedDashed line on both block sidesTry it
dottedDotted line on both block sidesTry it
With writing-modePhysical edges change when the writing mode is verticalTry it
noneNo block border. Initial styleTry it
<color>Color for both block sides. Default currentColorTry it
initialResets to the initial values (style none)Try it
inheritInherits this property from the parent elementTry it

How to Use border-block

Think in block start and end, not only top and bottom.

  1. Decide you want matching borders on the block axis (usually top and bottom in English layouts).
  2. Set a style such as solid or dashed. Without a style, nothing draws.
  3. Add width and color as needed: border-block: 4px solid #2563eb;.
  4. If start and end must differ, switch to border-block-start and border-block-end.
PieceRequired?Role
StyleYes (to show a line)Initial style is none
Width and colorOptionalDefaults: medium and currentColor
Same on both block sidesBy designOne value styles start and end together
writing-modeOptionalChanges which physical edges receive the border

Live Preview

Change border-block and the writing mode. Watch which physical edges pick up the border.

In horizontal-tb, block sides are top and bottom. In vertical-rl, they become the right and left edges.

Box

border-block: 4px solid #2563eb ยท writing-mode: horizontal-tb

CSS Examples

Each snippet focuses on border-block. Use Try It Yourself for a live editor.

Example 1 — Solid Block Borders

In horizontal text, this draws matching top and bottom borders.

CSS
<style>
  div {
    border-block: 4px solid #2563eb;
    padding: 12px;
  }
</style>

<div>Top and bottom borders</div>
Try It Yourself

How It Works

  1. Target the box. The rule applies to the div.
  2. Set a visible style. solid is required so a line appears.
  3. Set width and color. 4px and blue apply to both block sides.
  4. Map to physical edges. With default horizontal-tb, block-start is top and block-end is bottom. The left and right sides stay without a border.

Example 2 — Dashed Block Borders

Same shorthand shape, different style keyword.

CSS
<style>
  div {
    border-block: 3px dashed #dc2626;
    padding: 12px;
  }
</style>

<div>Dashed block sides</div>
Try It Yourself

How It Works

  1. Keep the logical axis. Still only the block-start and block-end sides.
  2. Swap the style. dashed replaces the continuous stroke.
  3. Keep both sides matched. One shorthand value always styles start and end the same.
  4. Leave the inline sides alone. Left and right stay open unless you also set border-inline.

Example 3 — Vertical Writing Mode

Change the writing mode and the same rule maps to different physical edges.

CSS
<style>
  div {
    writing-mode: vertical-rl;
    border-block: 4px solid #0f766e;
    padding: 12px;
  }
</style>

<div>Block sides follow writing mode</div>
Try It Yourself

How It Works

  1. Flip the flow. writing-mode: vertical-rl stacks lines vertically.
  2. Keep the logical border. border-block still means block-start and block-end.
  3. Watch the physical map. Those sides are no longer top and bottom; they land on the right and left edges.
  4. Why it matters. One logical rule stays correct across writing modes, unlike hard-coded border-top and border-bottom.

Edge Cases & Pitfalls

If the borders look wrong, one of these is usually why.

style

No style means no border

border-block: 4px #000 still draws nothing because style defaults to none. Include solid or another style keyword.

sides

Both block sides stay matched

border-block cannot set different start and end values. Use border-block-start and border-block-end when the sides must differ.

physical

Not always top and bottom

With writing-mode: vertical-rl, block sides map to the right and left. Physical longhands like border-top do not follow that shift.

inline

Inline sides need a different property

border-block never paints the inline edges. Pair it with border-inline, or use border for all four sides.

overlap

Physical and logical can fight

Setting both border-top and border-block can override each other depending on cascade order. Prefer one model in a component.

Browser Support

border-block is a browser CSS property for logical borders. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

border-block

Chrome 87+, Edge 87+, Firefox 66+, Safari 14.1+. Internet Explorer has no support.

97% Modern browser support
Google Chrome 87+
Full support
Mozilla Firefox 66+
Full support
Apple Safari 14.1+
Full support
Microsoft Edge 87+
Full support
Opera 73+
Full support
Samsung Internet 14+
Full support
Internet Explorer No support
Not supported
border-block Widely supported

Bottom line: Safe for modern browsers. Fall back to border-top and border-bottom only when you must support Internet Explorer. It is not a runtime API.

Key Takeaways

  • Role: one shorthand for matching borders on both logical block sides.
  • Logical mapping: usually top and bottom; can become left and right with vertical writing modes.
  • Not split values: both sides stay the same. Use start/end longhands to differ.
  • Style required. Not inherited. Pair with border-inline for the other axis.

One line: border-block: 4px solid blue; paints matching borders on the block axis โ€” wherever that axis points.

Frequently Asked Questions

It is a logical shorthand that sets border-block-width, border-block-style, and border-block-color on both the block-start and block-end sides at once.
A border needs a visible style. The initial style is none, so width or color alone will not draw a line. Use solid, dashed, or another style.
border-top and border-bottom always mean physical top and bottom. border-block follows writing-mode, so in horizontal text it maps to top and bottom, and in vertical text it can map to the left and right edges.
No. One border-block value styles both block sides the same. For different sides, use border-block-start and border-block-end.
Use border-inline for the inline-start and inline-end sides. Together, border-block and border-inline cover all four logical edges.
It is Baseline Widely available. Chrome 87+, Edge 87+, Firefox 66+, and Safari 14.1+ support it. Internet Explorer does not. It is a browser CSS property, not a Node.js feature.

Next: border-block-color

Set the color of both block borders without touching width or style.

border-block-color 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