CSSborder-block Property
Example
Set the style, color and width of the borders for different elements in the block direction:
border-block: 5px solid red;
}
h2 {
border-block: 4px dotted blue;
}
div {
border-block: double;
}
Definition and Usage
Theborder-block property is a shorthand property for these properties:
If values for color or width are omitted, default values will be used.
The CSSborder-block property is very similar to CSS propertyborder, but theborder-block property is dependent on block direction.
Note: The related CSS propertywriting-mode defines block direction. This affects where the start and end of a block is and the result of theborder-block property. For pages in English, inline direction is left to right and block direction is downward.
| Default value: | medium nonecolor |
|---|---|
| Inherited: | no |
| Animatable: | yes,see individual properties.Read aboutanimatableTry 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
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 aboutinitial | |
| inherit | Inherits this property from its parent element.Read aboutinherit |
More Examples
With writing-mode property
The position of the borders at the start and end in the block direction is affected by thewriting-mode property:
writing-mode: vertical-rl;
border-block: hotpink dashed 8px;
}
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

