Open In App

CSS | border-block Property

Improve
Improve
Like Article
Like
Save
Share
Report

The border-block property in CSS is used to set the individual logical block border property values in a single place in the style sheet. It sets the border top and bottom of the defining element.

Syntax:

border-block: border-width|border-style|border-color;

Property values:

  • border-width: This property value holds the width of the property.
  • border-style: This property holds the border style that can be dashed, solid etc.
  • border-color: This property holds the color of the border.

Below examples illustrate the border-block property in the CSS:

Example 1:




<!DOCTYPE html>
<html>
   
<head>
    <title>CSS | border-block Property</title>
    <style>
        h1 {
            color: green;
        }
           
        div {
            background-color: yellow;
            width: 220px;
            height: 40px;
        }
        .one {
            border-block: 5px solid yellow;
            background-color: purple;
        }
    </style>
</head>
   
<body>
    <center>
        <h1>Geeksforgeeks</h1>
        <b>CSS | border-block Property</b>
        <br><br>
        <div class="one">A Computer Science Portal</div>
    </center>
</body>
   
</html>


Output:

Example 2:




<!DOCTYPE html>
<html>
   
<head>
    <title>CSS | border-block Property</title>
    <style>
        h1 {
            color: green;
        }
           
        div {
            background-color: yellow;
            width: 220px;
            height: 40px;
        }
        .one {
            border-block: 5px dashed yellow;
            background-color: purple;
        }
    </style>
</head>
   
<body>
    <center>
        <h1>Geeksforgeeks</h1>
        <b>CSS | border-block Property</b>
        <br><br>
        <div class="one">A Computer Science Portal</div>
    </center>
</body>
   
</html>


Output:

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

  • Firefox
  • Opera
  • Edge


Last Updated : 26 Mar, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads