The background-origin property defines the background positioning area. It controls whether a background image is positioned relative to the border, padding, or content box of an element.
01
Positioning Area
Where placement starts.
02
Syntax
Three box keywords.
03
padding-box
Default origin value.
04
content-box
Tightest origin box.
05
background-clip
Related clipping property.
06
With position
Works with background-position.
Fundamentals
Definition and Usage
The background-origin CSS property sets the background positioning area of a background image. In other words, it decides which box is used as the reference frame for properties like background-position and background-size.
This is especially useful when an element has visible padding or borders and you want a small icon, badge, or decorative background placed relative to a specific part of the box.
💡
Beginner Tip
To see background-origin clearly, use a small non-repeating background image or gradient together with thick padding and a visible border.
Foundation
📝 Syntax
Apply background-origin to an element that already has a background-image:
Accepted values are border-box, padding-box, and content-box.
It affects the positioning area, not necessarily the painted clipping area.
Use it together with background-position and background-size for precise placement.
Compare it with background-clip, which controls where the background is painted.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
padding-box
Applies to
Background positioning area of an element
Inherited
No
Animatable
No
Common use
Icon placement, inset backgrounds, bordered cards
Defaults
Default Value
The initial value of background-origin is padding-box. That means the background positioning area starts at the outer edge of the padding, just inside the border.
Reference
💎 Property Values
These are the three background-origin keywords beginners use most often.
Value
Example
Meaning
border-box
background-origin: border-box;
Positioning starts from the outer edge of the border box
padding-box
background-origin: padding-box;
Positioning starts from the outer edge of the padding box
content-box
background-origin: content-box;
Positioning starts from the top-left of the content box
border-box
The positioning area includes the border. Useful when the border edge should act as the reference point.
The marker starts farthest out.
padding-box
The default value. Positioning starts just inside the border at the padding edge.
Most common default behavior.
content-box
Positioning starts inside the padding, aligned with the content area only.
Creates the most inset placement.
Compare
background-origin vs background-clip
Property
Controls
Best for
background-origin
Where the background positioning area starts
Aligning backgrounds with border, padding, or content edges
background-clip
Where the background is painted and clipped
Inset backgrounds, gradient text, framed panels
Preview
👀 Live Preview
These panels use the same small background marker, border, and padding. Only the origin value changes:
border-box
padding-box
content-box
Watch how the blue marker shifts inward as the origin box gets tighter.
Hands-On
Examples Gallery
Try background-origin with content-box, padding-box vs border-box, background-position, and a three-value comparison.
📚 Origin Boxes
Choose which box the browser should use as the reference for background placement.
Example 1 — content-box Origin
Start the background positioning area from the content box so padding pushes the image inward.
Each origin value shifts the reference box inward, which moves the same background marker to a different starting point.
🧠 How background-origin Works
1
You add a background image
Set a gradient, icon, or image using background-image.
Background
2
You choose an origin box
Pick border-box, padding-box, or content-box.
Origin rule
3
Position and size use that box
Properties like background-position and background-size are calculated from the chosen origin area.
Placement
=
📦
Precise background placement
You can align decorative backgrounds with borders, padding, or content edges.
Compatibility
Universal Browser Support
background-origin is supported in all modern browsers and is reliable for background placement in real projects.
✓ Baseline · Modern browsers
Control background placement in today’s browsers
Chrome, Firefox, Safari, Edge, and Opera support all three origin keywords.
97%Modern browser support
Google Chrome1+ · Desktop & Mobile
Full support
Mozilla Firefox4+ · Desktop & Mobile
Full support
Apple Safari3+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera10.5+ · Modern versions
Full support
Fallback behavior
In unsupported browsers, backgrounds still render using the default padding-box origin behavior.
💻
Internet Explorer 8 and earlierLimited support · Default placement still works
Partial
background-origin property97% supported
Bottom line: Use background-origin confidently in modern projects when you need precise background placement.
Wrap Up
Conclusion
The background-origin property gives you control over the background positioning area. Whether you want a decorative image aligned with the border, padding, or content edge, this property helps you place backgrounds exactly where you need them.
Start with the default padding-box, then compare content-box and border-box when working with bordered or padded elements.
Use thick borders and padding when teaching or testing origin values
Pair origin with background-position and background-size
Use small non-repeating backgrounds to make differences obvious
Compare origin with background-clip when learning both properties
Stick with padding-box unless you need tighter placement
❌ Don’t
Confuse background-origin with background-clip
Expect visible differences with full-cover backgrounds only
Forget that padding-box is the default
Assume origin changes clipping behavior by itself
Use origin alone without a background image or gradient
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about background-origin
Use these points when placing backgrounds inside bordered elements.
5
Core concepts
📦01
Positioning Area
Defines placement reference.
Purpose
📝02
Three Boxes
border, padding, content.
Values
👁03
padding-box Default
Common starting point.
Default
🛠04
Not clip
Origin vs painted area.
Compare
📍05
With Position
Works with background-position.
Layout
❓ Frequently Asked Questions
The background-origin property defines the background positioning area. It controls whether background-position and background-size are calculated from the border box, padding box, or content box.
The initial value is padding-box, which means the background positioning area starts at the outer edge of the padding, just inside the border.
background-origin decides where the background positioning area begins. background-clip decides where the background is actually painted and clipped.
padding-box is the default and works well for most layouts. Use content-box when you want backgrounds aligned tightly to content, or border-box when the border area should be included in positioning.
Yes. It affects any background image layer, including gradients, when background-size or background-position makes the effect depend on the element's box edges.