CSS border-block-color
The border-block-color
property in CSS specifies the color of an element’s block-start and block-end borders. The block-start and block-end sides depend on the writing mode, directionality, and text orientation of the element. This property allows you to set different or the same colors for the block-start and block-end borders.
Syntax of border-block-color
border-block-color: color | transparent | initial | inherit;
Values
Value | Description |
---|---|
color | Specifies the color of the block-start and block-end borders. Accepts any valid CSS color value (e.g., red , #ff0000 , rgba(255,0,0,0.5) ). |
transparent | Makes the block-start and block-end borders fully transparent. |
initial | Sets the property to its default value (currentColor). |
inherit | Inherits the value from the parent element. |
Default Value
currentColor
(inherits the current text color)
Examples for border-block-color
Using the CSS border-block-color Property
The following examples demonstrate how to use the border-block-color
property to set border colors for the block-start and block-end sides.
/* Set the same color for block-start and block-end borders */
.element {
border-block-color: blue;
}
/* Set different colors for block-start and block-end borders */
.element {
border-block-color: blue green;
}
/* Set the block borders to transparent */
.element {
border-block-color: transparent;
}
/* Inherit the block border colors from the parent */
.element {
border-block-color: inherit;
}
Example for Red Color Block Border
Below is an example demonstrating how to use border-block-color: red
to set red for the block-start border and red for the block-end border:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.box {
width: 300px;
padding: 10px;
border-block: 5px solid;
border-block-color: red;
}
</style>
</head>
<body>
<h2 class="box">Lorem Ipsum</h2>
</body>
</html>

Example for Different Block Border Colors
Below is an example demonstrating how to use border-block-color: red green
to set red for the block-start border and green for the block-end border:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.box {
width: 300px;
padding: 10px;
border-block: 5px solid;
border-block-color: red green;
}
</style>
</head>
<body>
<h2 class="box">Lorem Ipsum</h2>
</body>
</html>

Browser Support
The border-block-color
property is supported in modern browsers. Below is a compatibility table:
Browser | Version |
---|---|
Chrome | 87.0 |
Edge | 87.0 |
Firefox | 66.0 |
Safari | 14.1 |
Opera | 73.0 |