property
mask-image — CSS reference
Chooses mask layers. Initial none; not inherited. In alpha masks, opaque areas reveal and transparent areas hide. Failed image sources act as transparent black; a single none means no masking. Multiple layers can be combined.
Formal Syntax & Structure
css syntaxcss
[ none | <image> | <mask-source> ]#Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS masking and shapes lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}body{background:white} #a{position:relative;margin:20px;width:80px;height:60px;background:red;box-sizing:content-box}#a{mask-image:linear-gradient(to right,black 50%,transparent 50%)}</style><body><div id="a" aria-hidden="true"></div><p>Decorative shape example.</p></body></html>