function

cross-fade() — CSS reference

Blends candidate images using weights, with alpha-aware painting and context-dependent image sizing. The standard syntax differs from older prefixed two-image variants. This local browser rejects the standard example, so use a prior background or progressive enhancement.

Formal Syntax & Structure

css syntaxcss
cross-fade( [ <image> | <color> ] && <percentage>? , … ) (representative)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS image painting lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}body{background:white} #a{width:100px;height:80px;background-color:blue}#a{background-image:linear-gradient(red,red);background-image:cross-fade(linear-gradient(red,red) 50%, linear-gradient(blue,blue) 50%)}</style><body><div id="a" aria-hidden="true"></div><p>Decorative background sample.</p></body></html>
CSS Reference