CSS border-block Property


Example

Set the style, color and width of the borders for different elements in the block direction:

h1 {
  border-block: 5px solid red;
}

h2 {
  border-block: 4px dotted blue;
}

div {
  border-block: double;
}
Try it Yourself »

Definition and Usage

The border-block property is a shorthand property for these properties:

If values for color or width are omitted, default values will be used.

The CSS border-block property is very similar to CSS property border, but the border-block property is dependent on block direction.

Note: The related CSS property writing-mode defines block direction. This affects where the start and end of a block is and the result of the border-block property. For pages in English, inline direction is left to right and block direction is downward.

Show demo ❯

Default value: medium none color
Inherited: no
Animatable: yes, see individual properties. Read about animatable Try it
Version: CSS3
JavaScript syntax: object.style.borderBlock="dashed hotpink 10px" Try it

Browser Support

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

Property
border-block 87.0 87.0 66.0 14.1 73.0


CSS Syntax

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

Property Values

Value Description Demo
border-block-width Specifies the width of the border in the block direction. Default value is "medium" Demo ❯
border-block-style Specifies the style of the border in the block direction. Default value is "none" Demo ❯
border-block-color Specifies the color of the border in the block direction. Default value is the color of the text Demo ❯
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

More Examples

With writing-mode property

The position of the borders at the start and end in the block direction is affected by the writing-mode property:

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

Related Pages

CSS tutorial: CSS Border

CSS border property: CSS Border property

CSS border-block-color property: CSS Border-block-color property

CSS border-block-style property: CSS Border-block-style property

CSS border-block-width property: CSS Border-block-width property

CSS writing-mode property: CSS Writing-mode property


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.