property

background-position-x — CSS reference

Controls horizontal positioning for each layer. Initial 0%, not inherited. A right-edge offset may be represented as a calculated distance from the left. This is a physical axis even in RTL.

Formal Syntax & Structure

css syntaxcss
<length-percentage> | left | center | right [<length-percentage>]? (selected, comma-separated)

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-size:20px 20px;background-repeat:no-repeat;background-position-x:right 10px}</style><body><div id="a" aria-hidden="true"></div><p>Decorative background sample.</p></body></html>
CSS Reference