Open In App

CSS border-block-width Property

Last Updated : 17 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The border-block-width property sets the width of an element’s borders in the block direction. It defines the thickness of the block-start and block-end borders, adapting to the writing mode. This property ensures consistent border styling for elements, regardless of text flow direction.

Syntax:

border-block-width: width;

Property values:

  • width: This property holds the width of the border.

The below examples illustrate the border-block-width property in the CSS:

Example 1: In this example we use border-block-width to set the width of block borders, contrasting with dashed inline borders, demonstrating its effect within a styled div element.

html
<!DOCTYPE html>
<html>

<head>
    <title>CSS border-block-width Property</title>
    <style>
        h1 {
            color: green;
        }

        div {
            background-color: yellow;
            width: 220px;
            height: 40px;
        }

        .one {
            border: 5px dashed cyan;
            border-block-width: 2px;
            background-color: purple;
        }
    </style>
</head>

<body>
    <center>
        <h1>Geeksforgeeks</h1>
        <b>CSS border-block-width Property</b>
        <br><br>
        <div class="one">A Computer Science Portal</div>
    </center>
</body>

</html>

Output:

Example 2: In this example we use border-block-width to set a solid cyan border with a block width of 2px, within a purple background div.

html
<!DOCTYPE html>
<html>

<head>
    <title>CSS border-block-width Property</title>
    <style>
        h1 {
            color: green;
        }

        div {
            background-color: yellow;
            width: 220px;
            height: 40px;
        }

        .one {
            border: 5px solid cyan;
            border-block-width: 2px;
            background-color: purple;
        }
    </style>
</head>

<body>
    <center>
        <h1>Geeksforgeeks</h1>
        <b>CSS | border-block-width Property</b>
        <br><br>
        <div class="one">A Computer Science Portal</div>
    </center>
</body>

</html>

Output:

Supported Browsers:

The browsers supported by border-block-width property are listed below:



Next Article

Similar Reads