CSS border-block-style

The border-block-style property in CSS specifies the style 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 provides a shorthand for controlling the style of the block borders.


Syntax of border-block-style

</>
Copy
border-block-style: none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset | initial | inherit;

Values

ValueDescription
noneNo border is displayed.
hiddenSimilar to none, but the border conflicts are resolved for table elements.
dottedA dotted border is displayed.
dashedA dashed border is displayed.
solidA solid border is displayed.
doubleTwo solid lines are displayed as the border.
grooveA border that appears carved into the page (opposite of ridge).
ridgeA border that appears raised from the page (opposite of groove).
insetA border that makes the element appear embedded.
outsetA border that makes the element appear coming out of the page.
initialSets the property to its default value (none).
inheritInherits the value from its parent element.

Default Value

none


Examples for border-block-style

Using the CSS border-block-style Property

The following examples demonstrate how to use the border-block-style property to set the styles for the block-start and block-end borders.

</>
Copy
/* Set the block-start and block-end borders to solid */
.element {
  border-block-style: solid;
}

/* Set the block-start and block-end borders to dotted */
.element {
  border-block-style: dotted;
}

/* Set the block-start border to dashed and the block-end border to solid */
.element {
  border-block-style: dashed solid;
}

/* Inherit the block-start and block-end border styles from the parent */
.element {
  border-block-style: inherit;
}

Example for Dashed Block Borders

Below is an example demonstrating how to use border-block-style: dashed to apply dashed borders to the block-start and block-end sides:

index.html

</>
Copy
<!DOCTYPE html>
<html lang="en">
<head>
<style>
  .box {
    width: 300px;
    padding: 10px;
    border-block-width: 5px;
    border-block-style: dashed;
  }
</style>
</head>
<body>

<h2 class="box">Lorem Ipsum</h2>

</body>
</html>

Example for Dotted Block Borders

border-block-style: dotted;

index.html

</>
Copy
<!DOCTYPE html>
<html lang="en">
<head>
<style>
  .box {
    width: 300px;
    padding: 10px;
    border-block-width: 5px;
    border-block-style: dotted;
  }
</style>
</head>
<body>

<h2 class="box">Lorem Ipsum</h2>

</body>
</html>

Example for Solid Block Borders

border-block-style: solid;

</>
Copy
<!DOCTYPE html>
<html lang="en">
<head>
<style>
  .box {
    width: 300px;
    padding: 10px;
    border-block-width: 5px;
    border-block-style: solid;
  }
</style>
</head>
<body>

<h2 class="box">Lorem Ipsum</h2>

</body>
</html>

Browser Support

The border-block-style property is supported in modern browsers. Below is a compatibility table:

BrowserVersion
Chrome87.0
Edge87.0
Firefox66.0
Safari14.1
Opera73.0