Open In App

CSS | min-block-size Property

The min-block-size property in CSS is used to create the minimum horizontal or vertical size of an element. If the writing direction is horizontal then min-block-size is equivalent to min-height property, and if it is in vertical mode then equal to min-width property.

Syntax:



min-block-size: length| percentage| auto| none| min-content| 
                max-content| fit-content| inherit| initial| unset;

Property values:

Below examples illustrate the min-block-size property in CSS: 



Example 1: 




<!DOCTYPE html>
<html>
<head>
    <title>CSS | min-block-size Property</title>
    <style>
        h1 {
            color: green;
        }
         
        div {
            background-color: green;
            width: 200px;
            height: 20px;
        }
         
        .one {
            position: relative;
            min-block-size: 10px;
            background-color: cyan;
        }
    </style>
</head>
<body>
    <center>
        <h1>Geeksforgeeks</h1>
        <b>CSS | min-block-size Property</b>
        <br><br>
        <div>
            <p class="one">
                A Computer Science Portal for Geeks
            </p>
        </div>
    </center>
</body>
</html>

Output:

  

Example 2: 




<!DOCTYPE html>
<html>
<head>
    <title>CSS | min-block-size Property</title>
    <style>
        h1 {
            color: green;
        }
         
        div {
            background-color: green;
            width: 200px;
            height: 20px;
        }
         
        .one {
            position: relative;
                        writing-mode: vertical-rl;
            min-block-size: auto;
            background-color: cyan;
        }
    </style>
</head>
<body>
    <center>
        <h1>Geeksforgeeks</h1>
        <b>CSS | min-block-size Property</b>
        <br><br>
        <div>
            <p class="one">
                A Computer Science Portal for Geeks
            </p>
        </div>
    </center>
</body>
</html>

Output:

  

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

Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/min-block-size


Article Tags :