Open In App

CSS mask-origin property

The mask-origin property sets the position of the mask image with respect to different components of the box model and The mask-origin property in CSS is used to specify the origin position of a CSS mask image applied to an element. It determines the starting point of the mask image within the element’s content box, allowing control over where the mask is positioned.

Syntax:



mask-origin: Keyword values
/* Or */
mask-origin: Multiple values
/* Or */
mask-origin: Non-standard keyword values
/* Or */
mask-origin: Global values

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

Example 1: Below is the example that illustrates the mask-origin property using border-box :






<!DOCTYPE html>
<html>
<head>
    <style>
        .geeks {
            width: 22%;
            height: 200px;
            background: green;
            border: 10px solid red;
            padding: 10px;
            color: white;
            -webkit-mask-image:
                url("image.svg");
            -webkit-mask-repeat: repeat;
            mask-origin: border-box;
        }
    </style>
</head>
 
<body>
 
    <div class="geeks"></div>
 
</body>
</html>

Output:

Example 2: Below is the example that illustrates the mask-origin property using content-box :




<!DOCTYPE html>
<html>
<head>
    <style>
        .geeks {
            width: 22%;
            height: 200px;
            background: green;
            border: 10px solid red;
            padding: 10px;
            color: white;
            -webkit-mask-image:
                url("image.svg");
            -webkit-mask-repeat: repeat;
            mask-origin: content-box;
        }
    </style>
</head>
 
<body>
 
    <div class="geeks"></div>
 
</body>
</html>

Output:

Browsers Supported:


Article Tags :