property

mask-size — CSS reference

Scales the mask within its positioning area. Initial auto; not inherited. Cover fills the area, potentially cropping; contain preserves the whole image where possible. Percentages refer to the positioning area. An omitted second size is auto.

Formal Syntax & Structure

css syntaxcss
[ <length-percentage [0,∞]> | auto ]{1,2} | cover | contain (per layer)

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(black,black);mask-repeat:no-repeat;mask-size:40px 60px}</style><body><div id="a" aria-hidden="true"></div><p>Decorative shape example.</p></body></html>
CSS Reference