CSS border-block-color Property
Example
Set a color for the borders in block direction:
#example1 {
border-block-style: solid;
border-block-color: pink;
}
#example2 {
border-block-style: solid;
border-block-color: pink lightblue;
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The border-block-color
property sets the color of an element's borders in the block direction.
Note: For the border-block-color
property to take effect, the border-block-style
must be set.
Values for the border-block-color
property can be set in different ways:
If the border-block-color property has two values:
- border-block-color: pink lightblue;
- border color at block start is pink
- border color at block end is lightblue
If the border-block-color property has one value:
- border-block-color: pink;
- border color at block start and end is pink
The CSS
border-block-color
property is very similar to CSS properties
border-bottom-color
,
border-left-color
,
border-right-color
and
border-top-color
, but the
border-block-color
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-color
property. For pages in English, inline direction is left to right and block direction is downward.
Default value: | The current color of the element |
---|---|
Inherited: | no |
Animatable: | yes. Read about animatable Try it |
Version: | CSS3 |
JavaScript syntax: | object.style.borderBlockColor="pink" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
border-block-color | 87.0 | 87.0 | 66.0 | 14.1 | 73.0 |
CSS Syntax
border-block-color: color|transparent|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
color | Specifies the border color. Look at CSS Color Values for a complete list of possible color values. Default color is the current color of the element | Demo ❯ |
transparent | Specifies that the border color should be transparent | 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 border color at the start and end in the block direction is affected by the writing-mode
property:
div {
writing-mode: vertical-rl;
border-block-color: blue;
}
Try it Yourself »
Related Pages
CSS tutorial: CSS Border
CSS border property: CSS Border property
CSS border-block property: CSS Border-block property
CSS border-block-end-color property: CSS Border-block-end-color property
CSS border-block-start-color property: CSS Border-block-start-color property
CSS border-block-style property: CSS Border-block-style property
CSS border-bottom-width property: CSS Border-bottom-width property
CSS border-left-width property: CSS Border-left-width property
CSS border-right-width property: CSS Border-right-width property
CSS border-top-width property: CSS Border-top-width property
CSS writing-mode property: CSS Writing-mode property