property
background-size — CSS reference
Sizes each image independently. Initial auto auto, not inherited. Percentages resolve against the positioning area. Cover and contain preserve an available intrinsic aspect ratio; cover fills the area, contain fits inside it. A gradient has no intrinsic dimensions or ratio.
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 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-repeat:no-repeat;background-size:20px 30px}</style><body><div id="a" aria-hidden="true"></div><p>Decorative background sample.</p></body></html>