object.style.maskPosition = "value"; <'mask-position'> = <position># <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 (%).
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask-image: url(/assets/svg/HappyFace.svg);
mask-position: center;
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<div>center</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask-image: url(/assets/svg/HappyFace.svg);
mask-position: left;
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<div>left</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask-image: url(/assets/svg/HappyFace.svg);
mask-position: 100px 100px;
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<div>length</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask-image: url(/assets/svg/HappyFace.svg);
mask-position: 100% 100%;
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<div>percentage</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask-image: url(/assets/svg/HappyFace.svg);
mask-position: right;
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<div>right</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 16px);
mask-image: url(/assets/svg/HappyFace.svg);
mask-position: top;
mask-repeat: 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/HappyFace.svg);
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<button onmouseover="myfunction(innerHTML)">initial</button>
<button onmouseover="myfunction(innerHTML)">bottom</button>
<button onmouseover="myfunction(innerHTML)">center</button>
<button onmouseover="myfunction(innerHTML)">left</button>
<button onmouseover="myfunction(value)" value="100px 100px">length</button>
<button onmouseover="myfunction(value)" value="100% 100%">position</button>
<button onmouseover="myfunction(innerHTML)">right</button>
<button onmouseover="myfunction(innerHTML)">top</button>
<div>mask-position</div>
<script>
function myfunction(myparameter)
{
document.querySelector("div").style.maskPosition = myparameter;
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
div
{
background-color: yellow;
height: calc(100vh - 37px);
mask-image: url(/assets/svg/HappyFace.svg);
mask-repeat: no-repeat;
}
</style>
</head>
<body>
<button>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)
{
document.querySelector("div").style.maskPosition = myparameter;
}
const myelements = document.querySelectorAll("button");
for(let myelement of myelements)
{
let myargument = myelement.innerHTML;
if(myelement.value)
{
myargument = myelement.value;
}
myelement.addEventListener("mouseover", function(){myfunction(myargument)});
}
</script>
</body>
</html>