The background-position-x property controls the horizontal placement of a background image. It lets you move a background left or right without changing its vertical position.
01
Horizontal Axis
Move backgrounds sideways.
02
Keywords
left, center, right.
03
Percentages
Relative x placement.
04
Pixels
Exact left offsets.
05
With position-y
Split axis control.
06
Shorthand
Related to background-position.
Fundamentals
Definition and Usage
The background-position-x CSS property sets the horizontal starting position of a background image. It affects placement along the x-axis only, leaving the vertical position to background-position-y or the shorthand background-position.
This is useful when you want to align a decorative icon, badge, or photo to the left, center, or right while keeping vertical placement unchanged.
💡
Beginner Tip
Use a small non-repeating background with a fixed background-size so horizontal movement is easy to see.
Foundation
📝 Syntax
Apply background-position-x to control horizontal background placement:
Only the horizontal value changes, so the marker moves sideways while staying vertically centered.
🧠 How background-position-x Works
1
You add a background image
Set an image or gradient with background-image.
Background
2
You set the x-axis position
Use background-position-x with left, center, right, percentages, or pixels.
Horizontal rule
3
Vertical placement stays separate
Control the y-axis with background-position-y or the shorthand background-position.
Split axes
=
↔
Precise horizontal control
You can align backgrounds to the left, center, or right without affecting vertical placement.
Compatibility
Universal Browser Support
background-position-x is supported in all modern browsers and works reliably for horizontal background placement.
✓ Baseline · Modern browsers
Control horizontal background placement today
Chrome, Firefox, Safari, Edge, and Opera support keyword, percentage, and length values.
98%Modern browser support
Google Chrome1+ · Desktop & Mobile
Full support
Mozilla Firefox49+ · Desktop & Mobile
Full support
Apple Safari15+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera36+ · Modern versions
Full support
Fallback behavior
In older browsers, use the shorthand background-position as a fallback when split-axis properties are unavailable.
💻
Legacy browsersMay require background-position instead of split x/y properties
Fallback
background-position-x property98% supported
Bottom line: Use background-position-x confidently in modern projects, especially with background-position-y for split-axis control.
Wrap Up
Conclusion
The background-position-x property gives you direct control over horizontal background placement. It is especially useful when you want to align an image left, center, or right without changing its vertical position.
Pair it with background-position-y for full two-axis control, or use background-position when a single shorthand declaration is enough.
Use left, center, and right for simple horizontal alignment
Pair with background-position-y when axes need separate control
Use percentages for responsive horizontal placement
Keep non-repeating backgrounds small when teaching placement
Provide a background-position fallback for older browsers if needed
❌ Don’t
Confuse background-position-x with the full shorthand property
Expect visible movement when the background fully covers the element
Forget that the default horizontal position is left (0%)
Change x and y in separate places when shorthand would be simpler
Ignore focal points on responsive hero images
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about background-position-x
Use these points when placing backgrounds horizontally.
5
Core concepts
↔01
Horizontal Only
Controls the x-axis.
Purpose
📝02
Keywords
left, center, right.
Values
📊03
Percentages
Responsive x placement.
Responsive
⚡04
0% Default
Left edge by default.
Default
🛠05
With position-y
Split axis control.
Compare
❓ Frequently Asked Questions
The background-position-x property sets the horizontal position of a background image. It controls placement along the x-axis without changing the vertical position.
The initial value is 0%, which places the background at the left edge of the background positioning area.
Yes. The common keywords are left, center, and right.
background-position-x controls only the horizontal axis. background-position can set both horizontal and vertical placement in one declaration.
Yes. You can use both properties together to control horizontal and vertical placement separately.