Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Container Queries and Logical Properties

The border-block property

Reference for the CSS border-block shorthand: set width, style and color of both block-axis borders, with live examples and usage notes.

The border-block shorthand draws a border on both sides of the block axis: the top and bottom in horizontal text, or the left and right in vertical text. Like border, it accepts a width, a style and a color in any order, and it sets them for the block-start and block-end sides at once.

To style the two sides differently, use border-block-start and border-block-end. For individual parts, there are also border-block-width, border-block-style and border-block-color.

CSS
.section { border-block: 2px solid #888; }
.title { border-block-end: 3px double #2a62d9; }

Try it

Lines above and below
Vertical writing mode

Syntax

CSS
border-block: <'border-block-width'> || <'border-block-style'> || <'border-block-color'>;
  • Initial value: medium none currentcolor (no visible border, because the style is none)
  • Applies to: all elements
  • Inherited: no
  • Animatable: width and color yes; style is discrete
  • Computed value: each part as specified, with the width made absolute (0 if the style is none or hidden)

Values

Value Description
Width A length or thin, medium, thick. Default medium.
Style none, hidden, solid, dashed, dotted, double, groove, ridge, inset, outset. Required for the border to appear.
Color Any color. Defaults to the element's color (currentcolor).

Usage notes

  • A style is required. border-block: 3px red shows nothing, because the omitted style falls back to none.
  • The same value for both sides. The shorthand cannot give start and end different values. Add border-block-start or border-block-end afterwards to override one.
  • Resets omitted parts. Like border, leaving out the color or width resets that part to its initial value, overriding earlier declarations.
  • Rounded corners are separate. border-block draws only straight edges; corner shapes come from border-radius or logical corner properties.
  • Layout effect. Borders take space and add to the element's size unless box-sizing: border-box is used.

Browser support

Supported in all current browsers.