# background-position

> The `background-position` CSS property specifies the initial position of a background image within its container.

## How do I position a background image in CSS?

The property that sets the starting position of a background image within an element. It allows precise control over where the image appears, using coordinates, keywords or percentages.

- Topic: Background
- Type: property
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 1+, Firefox Android 4+, Safari 1+, Safari iOS 1+

## Example

```css
.card {
  background: url("icon.svg") no-repeat;
  background-position: right 16px top 16px;
}
```

Edge keywords with offsets place the icon 16px from the right and top edges of the card.

## Common mistakes

- Percent values don't move the image by that distance; they align the same point of the image and the container.
- Only one value is given, so the other axis silently defaults to `center`.

## Key points

- Offsets from the right or bottom edge use the edge keyword syntax like `right 20px bottom 10px`, not `calc()` hacks.
- Cropped photos keep the important part visible with a matching position, such as `center top` for faces.

## Interview questions

### What does background-position: 50% 50% mean?

It places the center point of the image at the center point of the box. With percentages, the same point of the image and the container line up.

### How do I center a background image?

Use `background-position: center`. It centers the image on both axes.

### Can I animate background-position?

Yes, `background-position` is animatable, but animating it repaints each frame; a transformed pseudo-element is usually smoother.

## Related cards

- [background-image](https://wonderium.dev/css/background-image.md)
- [background-size](https://wonderium.dev/css/background-size.md)
- [background-origin](https://wonderium.dev/css/background-origin.md)
- [object-position](https://wonderium.dev/css/object-position.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/background-position
- Last updated: 2026-11-25
