The mask property for CSS is shorthand for mask-image, mask-position, mask-size, mask-repeat, mask-origin, mask-clip, mask-composite, and mask-mode.
object.style.mask = "value"; <mask-layer> = <mask-reference> || <position> [ / <bg-size> ]? ||<repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode> <mask-reference> = none | <image> | <mask-source> none A transparent black image layer.
<image> = <url> | <gradient> <url> = url( <string> <url-modifier>* ) <string> Specifies a sequence of characters delimited by double quotes (") or single quotes (').
<url-modifier> Changes the meaning or the interpretation of the URL.
<gradient> = <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> <linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> ) deg Degrees. There are 360 degrees in a full circle.
grad Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle.
rad Radians. There are 2p radians in a full circle.
turn Turns. There is 1 turn in a full circle.
<side-or-corner> = [left | right] || [top | bottom] <color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]# <linear-color-stop> = <color> && <length-percentage>? <color> Specifies the color using a keyword or a numerical specification.
<length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<linear-color-hint> = <length-percentage> <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<repeating-linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> ) deg Degrees. There are 360 degrees in a full circle.
grad Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle.
rad Radians. There are 2p radians in a full circle.
turn Turns. There is 1 turn in a full circle.
<side-or-corner> = [left | right] || [top | bottom] <color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]# <linear-color-stop> = <color> && <length-percentage>? <color> Specifies the color using a keyword or a numerical specification.
<length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<linear-color-hint> = <length-percentage> <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<radial-gradient()> = radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> ) <ending-shape> Determines whether the gradient's ending shape is a circle or an ellipse.
<size> Determines the size of the gradient's ending shape.
<position> = [ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ] <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]# <linear-color-stop> = <color> && <length-percentage>? <color> Specifies the color using a keyword or a numerical specification.
<length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<linear-color-hint> = <length-percentage> <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<repeating-radial-gradient()> = radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> ) <ending-shape> Determines whether the gradient's ending shape is a circle or an ellipse.
<size> Determines the size of the gradient's ending shape.
<position> = [ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ] <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]# <linear-color-stop> = <color> && <length-percentage>? <color> Specifies the color using a keyword or a numerical specification.
<length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<linear-color-hint> = <length-percentage> <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<url> = url( <string> <url-modifier>* ) <string> Specifies a sequence of characters delimited by double quotes (") or single quotes (').
<url-modifier> Changes the meaning or the interpretation of the URL.
<position> = [ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ] <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
<bg-size> = [ <length-percentage [0,∞]> | auto ]{1,2} | cover | contain <length-percentage> =
<length> |
<percentage> <length> Specifies the length using a number followed by a unit of measurement.
<percentage> Specifies the percentage using a number followed by a percent sign (%).
auto Automatically specified by the user agent.
cover Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.
contain Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.
<repeat-style> = repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2} repeat-x The image is repeated in the horizontal direction as often as needed to cover the background painting area.
repeat-y The image is repeated in the vertical direction as often as needed to cover the background painting area.
repeat The image is repeated in the horizontal and vertical direction as often as needed to cover the background painting area.
space The image is repeated as often as will fit within the background positioning area without being clipped and then the images are spaced out to fill the area.
round The image is repeated as often as will fit within the background positioning area. If it doesn't fit a whole number of times, it is rescaled so that it does.
no-repeat The image is placed once and not repeated in this direction.
<geometry-box> = <shape-box> | fill-box | stroke-box | view-box <shape-box> = <box> | margin-box <box> = border-box | padding-box | content-box border-box Area within the border box.
padding-box Area within the padding box.
content-box Area within the content box.
margin-box Area within the margin box.
fill-box Uses the object bounding box as a reference box.
stroke-box Uses the stroke bounding box as a reference box.
view-box Uses the nearest SVG viewport as a reference box.
no-clip The painted content is not restricted (not clipped).
<compositing-operator> = add | subtract | intersect | exclude add The source is placed over the destination.
subtract The source is placed, where it falls outside of the destination.
intersect The parts of source that overlap the destination, replace the destination.
exclude The non-overlapping regions of source and destination are combined.
<masking-mode> = alpha | luminance | match-source alpha Indicates the alpha values of the mask layer image should be used as the mask values.
luminance Indicates the luminance values of the mask layer image should be used as the mask values.
match-source The value specified by the referenced mask element's mask-type property must be used.
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box content-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>content-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box fill-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>fill-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box margin-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>margin-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box no-clip;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>no-clip</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box padding-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>padding-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box stroke-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>stroke-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box view-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>view-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask-image: url(/assets/svg/Happy100.svg);
mask-origin: margin-box;
padding: 10px;
}
</style>
</head>
<body>
<button value="border-box">initial</button>
<button>border-box</button>
<button>content-box</button>
<button>fill-box</button>
<button>margin-box</button>
<button>no-clip</button>
<button>padding-box</button>
<button>stroke-box</button>
<button>view-box</button>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>mask-clip</span>
</div>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = "url(/assets/svg/Happy100.svg) border-box " + myproperty;
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) add, url(/assets/svg/Star.svg);
}
</style>
</head>
<body>
<div>add</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) exclude, url(/assets/svg/Star.svg);
}
</style>
</head>
<body>
<div>exclude</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) intersect, url(/assets/svg/Star.svg);
}
</style>
</head>
<body>
<div>intersect</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) subtract, url(/assets/svg/Star.svg);
}
</style>
</head>
<body>
<div>subtract</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 37px);
mask-image: url(/assets/svg/Happy100.svg), url(/assets/svg/Star.svg);
}
</style>
</head>
<body>
<button value="add">initial</button>
<button>add</button>
<button>exclude</button>
<button>intersect</button>
<button>subtract</button>
<div>mask</div>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = "url(/assets/svg/Happy100.svg) " + myproperty + ", url(/assets/svg/Star.svg)";
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: linear-gradient(black, transparent);
}
</style>
</head>
<body>
<div>linear-gradient</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: radial-gradient(black, transparent);
}
</style>
</head>
<body>
<div>radial-gradient</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg);
}
</style>
</head>
<body>
<div>url</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: none;
}
</style>
</head>
<body>
<div>none</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 37px);
}
</style>
</head>
<body>
<button value="none">initial</button>
<button value="linear-gradient(black, transparent)">linear-gradient</button>
<button value="radial-gradient(black, transparent)">radial-gradient</button>
<button value="url(/assets/svg/Happy100.svg)">url</button>
<button>none</button>
<div>mask-image</div>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = myproperty;
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
mask: url(#myid) alpha;
}
mask
{
mask-type: alpha;
}
</style>
</head>
<body>
<div>alpha</div>
<svg>
<mask id="myid">
<rect fill="red" height="100" width="100"/>
</mask>
</svg>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
mask: url(#myid) luminance;
}
mask
{
mask-type: alpha;
}
</style>
</head>
<body>
<div>luminance</div>
<svg>
<mask id="myid">
<rect fill="red" height="100" width="100"/>
</mask>
</svg>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
mask: url(#myid) match-source;
}
mask
{
mask-type: alpha;
}
</style>
</head>
<body>
<div>match-source</div>
<svg>
<mask id="myid">
<rect fill="red" height="100" width="100"/>
</mask>
</svg>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
mask-image: url(#myid);
}
mask
{
mask-type: alpha;
}
</style>
</head>
<body>
<button value="match-source">initial</button>
<button>alpha</button>
<button>luminance</button>
<button>match-source</button>
<div>mask-mode</div>
<svg>
<mask id="myid">
<rect fill="red" height="100" width="100"/>
</mask>
</svg>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = "url(#myid) " + myproperty;
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) border-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>border-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) content-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>content-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) fill-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>fill-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) margin-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>margin-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) padding-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>padding-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) stroke-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>stroke-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask: url(/assets/svg/Happy100.svg) view-box;
padding: 10px;
}
</style>
</head>
<body>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>view-box</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
border-style: solid;
border-width: 10px;
margin: 10px;
mask-image: url(/assets/svg/Happy100.svg);
padding: 10px;
}
</style>
</head>
<body>
<button value="border-box">initial</button>
<button>border-box</button>
<button>content-box</button>
<button>fill-box</button>
<button>margin-box</button>
<button>padding-box</button>
<button>stroke-box</button>
<button>view-box</button>
<div>
<svg height="100" width="100">
<rect fill="red" height="90" stroke="blue" stroke-width="10" width="90" x="5" y="5"/>
</svg>
<span>mask-origin</span>
</div>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = "url(/assets/svg/Happy100.svg) " + myproperty;
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) bottom no-repeat;
}
</style>
</head>
<body>
<div>bottom</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) center no-repeat;
}
</style>
</head>
<body>
<div>center</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) left no-repeat;
}
</style>
</head>
<body>
<div>left</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) 100px 100px no-repeat;
}
</style>
</head>
<body>
<div>length</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) 100% 100% no-repeat;
}
</style>
</head>
<body>
<div>percentage</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) right no-repeat;
}
</style>
</head>
<body>
<div>right</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) top no-repeat;
}
</style>
</head>
<body>
<div>top</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 37px);
mask-image: url(/assets/svg/Happy100.svg);
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<button value="0% 0%">initial</button>
<button>bottom</button>
<button>center</button>
<button>left</button>
<button value="100px 100px">length</button>
<button value="100% 100%">position</button>
<button>right</button>
<button>top</button>
<div>mask-position</div>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = "url(/assets/svg/Happy100.svg) " + myproperty + " no-repeat";
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) no-repeat;
}
</style>
</head>
<body>
<div>no-repeat</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) repeat;
}
</style>
</head>
<body>
<div>repeat</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) repeat-x;
}
</style>
</head>
<body>
<div>repeat-x</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) repeat-y;
}
</style>
</head>
<body>
<div>repeat-y</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) round;
}
</style>
</head>
<body>
<div>round</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) space;
}
</style>
</head>
<body>
<div>space</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 37px);
mask-image: url(/assets/svg/Happy100.svg);
}
</style>
</head>
<body>
<button value="repeat">initial</button>
<button>no-repeat</button>
<button>repeat</button>
<button>repeat-x</button>
<button>repeat-y</button>
<button>round</button>
<button>space</button>
<div>mask-repeat</div>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = "url(/assets/svg/Happy100.svg) " + myproperty;
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) 0% 0% / auto;
}
</style>
</head>
<body>
<div>auto</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) 0% 0% / contain;
}
</style>
</head>
<body>
<div>contain</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) 0% 0% / cover;
}
</style>
</head>
<body>
<div>cover</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) 0% 0% / 100px 50px;
}
</style>
</head>
<body>
<div>length</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask: url(/assets/svg/Happy100.svg) 0% 0% / 100% 50%;
}
</style>
</head>
<body>
<div>percentage</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 37px);
mask-image: url(/assets/svg/Happy100.svg);
}
</style>
</head>
<body>
<button value="auto">initial</button>
<button>auto</button>
<button>contain</button>
<button>cover</button>
<button value="100px 50px">length</button>
<button value="100% 50%">percentage</button>
<div>mask-size</div>
<script>
function myfunction(myparameter)
{
const mytarget = myparameter.target;
const myproperty = mytarget.value || mytarget.innerHTML;
document.querySelector("div").style.mask = "url(/assets/svg/Happy100.svg) 0% 0% / " + myproperty;
}
for(const mybutton of document.querySelectorAll("button"))
{
mybutton.addEventListener("mouseover", myfunction);
}
</script>
</body>
</html>