property

background-origin — CSS reference

Chooses the rectangle used for background positioning and sizing. Initial padding-box, not inherited. This is distinct from the painting clip. A fixed attachment uses the initial containing block instead of this box.

Formal Syntax & Structure

css syntaxcss
[ border-box | padding-box | content-box ]#

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);padding:10px;border:5px solid transparent;background-size:20px 20px;background-repeat:no-repeat;background-origin:content-box}</style><body><div id="a" aria-hidden="true"></div><p>Decorative background sample.</p></body></html>
CSS Reference