CSS border-block attribute

Definition and Usage

border-block The property is a shorthand for the following properties:

If the value of color or width is omitted, the default value will be used.

CSS border-block The property corresponds to border The properties are very similar, but border-block The property depends on the block direction.

Note:related CSS properties writing-mode Defines the block direction. This affects the starting and ending positions of the block as well as border-block The result of the property. For English pages, the inline direction is from left to right, and the block direction is downward.

Instance

Example 1

Set styles, colors, and widths for borders on different elements on the block direction:

h1 {
  border-block: 5px solid red;
}
h2 {
  border-block: 4px dotted blue;
}
div {
  border-block: double;
}

Try It Yourself

Example 2: Combined with the writing-mode property

The positions of the starting and ending borders on the block direction are affected by writing-mode Property Affects:

div {
  writing-mode: vertical-rl;
  border-block: hotpink dashed 8px;
}

Try It Yourself

CSS Syntax

border-block: border-block-width border-block-style border-block-color |initial|inherit;

Property Value

Value Description
border-block-width Specifies the width of the border on the block direction. The default value is medium.
border-block-style Specifies the style of the border on the block direction. The default value is none.
border-block-color Specifies the color of the border on the block direction. The default value is the text color.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default Value: medium none color
Inheritance: No
Animation Creation: Supported. See:Animation-related properties.
Version: CSS3
JavaScript Syntax: object.style.borderBlock="dashed hotpink 10px"

Browser Support

The numbers in the table represent the browser version that first fully supports this property.

Chrome Edge Firefox Safari Opera
87.0 87.0 66.0 14.1 73.0

Related Pages

Tutorial:CSS Border

Reference:CSS border attribute

Reference:CSS border-block-color attribute

Reference:CSS border-block-style attribute

Reference:CSS border-block-width attribute

Reference:CSS writing-mode property