CSS border-block-start

The border-block-start property in CSS is a shorthand property for setting the width, style, and color of an element’s block-start border. The block-start side depends on the element’s writing mode, directionality, and text orientation. This property simplifies managing the appearance of the block-start border in layouts.


Syntax of border-block-start

</>
Copy
border-block-start: border-block-start-width border-block-start-style border-block-start-color | initial | inherit;

Values

ValueDescription
border-block-start-widthSpecifies the width of the block-start border. Accepts values like thin, medium, thick, or any valid CSS length (e.g., 2px).
border-block-start-styleDefines the style of the block-start border. Accepts values like solid, dashed, dotted, none, etc.
border-block-start-colorSpecifies the color of the block-start border. Accepts any valid CSS color value (e.g., red, #ff0000, rgba(255,0,0,0.5)).
initialSets the property to its default value (border is medium none currentColor).
inheritInherits the value from its parent element.

Default Value

medium none currentColor


Examples for border-block-start

Using the CSS border-block-start Property

The following examples demonstrate how to use the border-block-start property to set the appearance of the block-start border.

</>
Copy
/* Set the width, style, and color of the block-start border */
.element {
  border-block-start: 5px solid blue;
}

/* Set only the style and color of the block-start border */
.element {
  border-block-start: dotted red;
}

/* Set the block-start border to transparent */
.element {
  border-block-start: thin solid transparent;
}

/* Inherit the block-start border properties from the parent */
.element {
  border-block-start: inherit;
}

Example for a Solid Block-Start Border

Below is an example demonstrating how to use border-block-start: 4px solid #4CAF50; to apply a solid green border to the block-start side:

index.html

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

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

</body>
</html>

Example for a Dotted Red Block-Start Border

border-block-start: dotted red;

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

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

</body>
</html>

Browser Support

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

BrowserVersion
Chrome69.0
Edge79.0
Firefox41.0
Safari12.1
Opera56.0