# background-origin

> The `background-origin` CSS property specifies where the background images or colors originate from within an element's box model.

## What is the difference between background-origin and background-clip?

The property that defines where the background image or color is positioned within an element. It can be positioned from the 'border-box', 'padding-box' or 'content-box', affecting how the background is aligned relative to the element's boundaries.

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

## Example

```css
.note {
  padding: 24px;
  background: url("pin.svg") no-repeat left top;
  background-origin: content-box;
}
```

'content-box' positions the image from the content edge, so the pin sits inside the 24px padding, aligned with the text.

## Common mistakes

- Changing `background-origin` seems to do nothing because the element has no padding or border.
- The background color still fills the border area, because `background-origin` only moves images, not where they are painted.

## Key points

- Background images that should start inside the padding use `background-origin`, not extra margins on the image.
- Code doesn't rely on `background-origin` for backgrounds that use `background-attachment: fixed`, where it is ignored.

## Interview questions

### What is the default value of background-origin?

The default is `padding-box`, so images are positioned from the inner edge of the border.

### Does background-origin affect background-color?

No. It only affects background images; use `background-clip` to control where the color is painted.

## Related cards

- [background-clip](https://wonderium.dev/css/background-clip.md)
- [background-position](https://wonderium.dev/css/background-position.md)
- [padding](https://wonderium.dev/css/padding.md)
- [box-sizing](https://wonderium.dev/css/box-sizing.md)

---

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