background-position-x

Specifically controls the horizontal (left-to-right) position of a background image. This is useful when you want to change only the horizontal position via hover or animation without touching the vertical position.

It is documented as part of the CSS Backgrounds and Borders specification.

/* Usage Example */
.banner {
  background-image: url(';pattern.png');
  /* Precisely moves the pattern 50px from the left */
  background-position-x: 50px;
}

/* Syntax */
background-position-x: center;
background-position-x: left;
background-position-x: right;
background-position-x: x-start;
background-position-x: x-end;

/* Global values */
background-position-x: inherit;
background-position-x: initial;
background-position-x: revert;
background-position-x: revert-layer;
background-position-x: unset;
Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

1+
49+
1+
12+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC