property

mask — CSS reference

Shorthand for mask layer properties; omitted components reset. Also resets mask-border longhands. Masking operates on the painted group without resizing its layout box.

Formal Syntax & Structure

css syntaxcss
<mask-layer># (image, mode, position/size, repeat, geometry boxes, composite)

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:linear-gradient(to right,black 50%,transparent 50%) no-repeat}</style><body><div id="a" aria-hidden="true"></div><p>Decorative shape example.</p></body></html>
CSS Reference