function
image-set() — CSS reference
Provides candidate images, optionally with resolution and MIME-type information. The user agent chooses an appropriate candidate; do not assume device pixel ratio alone controls selection. Include a preceding background-image for browsers that cannot parse the function.
Formal Syntax & Structure
css syntaxcss
image-set( [ <image> | <string> ] [ <resolution> || type(<string>) ]?, … ) (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:image-set(linear-gradient(red,red) 1x, linear-gradient(blue,blue) 2x)}</style><body><div id="a" aria-hidden="true"></div><p>Decorative background sample.</p></body></html>