Skip to content
Related Articles
Open in App
Not now

Related Articles

CSS | shape-image-threshold Property

Improve Article
Save Article
  • Last Updated : 29 Aug, 2022
Improve Article
Save Article

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:

  • alpha-value: It is used to set the threshold for extracting the shape. The pixels which are greater than the threshold value would be considered for the shape. A decimal value from 0.0 to 1.0 can be used for setting the threshold from fully transparent to fully opaque. If the values are outside the range they are clamped to this range.

Below examples illustrate the shape-image-threshold Property

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

HTML




<!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 

HTML




<!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:

  • Google Chrome 37+
  • Edge 79+
  • Firefox 62+
  • Safari 10.1+
  • Opera 24+

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!