CSS mask-composite property

The mask-composite property defines multiple composite operations to combine multi-mask layers. The first URL layer is at the top and the last URL layer is at the bottom of all the layers.

Syntax:

mask-composite: Keyword values
/* Or */
mask-composite: Global values

Property values: This property accepts values mentioned above and described below:

  • Keyword values: This property value refers to the values defined with units like add, subtract, intersect, exclude, etc.
  • Global values: This property value refers to the values defined with units like inherit, initial, unset, etc

Example 1: Below example illustrates the mask-composite property using add :

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
    <head>
        <style>
  
        .geeks{
              width: 22%;
              height: 200px;
              background: green;
              -webkit-mask-image: 
                url("image.svg"), 
                url("image2.svg");
              -webkit-mask-size: 140px, 120px;
              -webkit-mask-position: 140px 60px, 50px;
              -webkit-mask-repeat: no-repeat;
              mask-composite: add;
        }
  
        </style>
    </head>
<body>
  
    <div class="geeks"></div>
  
</body>
</html>

chevron_right


Output:



Example 2: Below example illustrates the mask-composite property using subtract :

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
    <head>
        <style>
  
        .geeks{
              width: 22%;
              height: 200px;
              background: green;
              -webkit-mask-image: 
                url("image.svg"), 
                url("image2.svg");
              -webkit-mask-size: 140px, 120px;
              -webkit-mask-position: 140px 60px, 50px;
              -webkit-mask-repeat: no-repeat;
              mask-composite: subtract;
        }
  
        </style>
    </head>
<body>
  
    <div class="geeks"></div>
  
</body>
</html>

chevron_right


Output:

Browsers Supported:

  • Firefox
  • Chrome (Not Supported)
  • Opera (Not Supported)
  • Safari (Not Supported)
  • Edge (Not Supported)
  • Internet Explorer (Not Supported)



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.