Open In App

CSS | shape-image-threshold Property

The shape-image-threshold property is used to set the threshold of the alpha channel used to extract the shape when using an image for shape-outside. 

Syntax:



shape-image-threshold: <alpha-value>

Property Values:

Below examples illustrate the shape-image-threshold Property



Example 1: In this example, we will set the threshold to 0.5 




<!DOCTYPE html>
<html>
<head>
    <title>
        CSS | shape-image-threshold
    </title>
    <style>
        .outline {
            shape-outside: linear-gradient(
                    to right, green, transparent);
         
            /* shape-image-threshold effect */
            shape-image-threshold: 0.4;
            background-image: linear-gradient(
                    to right, green, transparent);
            width: 300px;
            height: 130px;
            float: left;
        }
    </style>
</head>
<body>
    <center>
        <h1 style="color: green">
            GeeksforGeeks
        </h1>
        <b>
            CSS | shape-image-threshold: 0.5;
        </b>
        <br><br>
    </center>
    <div class="outline"></div>
    <div class="container">
        GeeksforGeeks is a computer science portal
        with a huge variety of well written and
        explained computer science and programming
        articles, quizzes and interview questions.
        The portal also has dedicated GATE preparation
        and competitive programming sections.
        <br><br>
        GeeksforGeeks is a computer science portal
        with a huge variety of well written and
        explained computer science and programming
        articles, quizzes and interview questions.
        The portal also has dedicated GATE preparation
        and competitive programming sections.
    </div>
</body>
</html>

Output: 

Example 2: In this example, we will set the threshold to 0.2 




<!DOCTYPE html>
<html>
<head>
    <title>
        CSS | shape-image-threshold
    </title>
    <style>
        .outline {
            shape-outside: linear-gradient(20deg,
                rgb(77, 26, 103), transparent 80%,
                transparent);        
             
            /* shape-image-threshold effect */
            shape-image-threshold: 0.2;
            background-image: linear-gradient(
                to top, green, transparent);
            width: 300px;
            height: 125px;
            float: left;
        }
    </style>
</head>
<body>
    <center>
        <h1 style="color: green">
            GeeksforGeeks
        </h1>
        <b>
            CSS | shape-image-threshold: 0.2;
        </b>
        <br><br>
    </center>
    <div class="outline"></div>
    <div class="container">
        GeeksforGeeks is a computer science portal
        with a huge variety of well written and
        explained computer science and programming
        articles, quizzes and interview questions.
        The portal also has dedicated GATE preparation
        and competitive programming sections.
        <br><br>
        GeeksforGeeks is a computer science portal
        with a huge variety of well written and
        explained computer science and programming
        articles, quizzes and interview questions.
        The portal also has dedicated GATE preparation
        and competitive programming sections.
    </div>
</body>
</html>

Output: 

Supported Browsers: The browsers supported by shape-image-threshold property are listed below:


Article Tags :