property

background-clip — CSS reference

Restricts where the background can paint. Initial border-box, not inherited. The clip need not equal the positioning area. Text clipping requires careful text-color and fallback design, especially with forced colors.

Formal Syntax & Structure

css syntaxcss
[ border-box | padding-box | content-box | text ]# (selected)

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-clip:content-box}</style><body><div id="a" aria-hidden="true"></div><p>Decorative background sample.</p></body></html>
CSS Reference