CSS background-origin property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxFully supports
Internet ExplorerFully supports
EdgeFully supports
OperaFully supports
Description
CSS background-origin property specifies the position of background image with respect to different components of box model i.e. we define a point where we start measuring for the background position.
We position the image to top left corner.
Syntax
background-origin : border-box | padding-box | content-box
Property values
padding-boxDefault
-
The background image is positioned relative to the padding box.
See the background-image is behind the padding area.
- Try it
background-origin: padding-box; border-box
-
The background image is positioned relative to the border box.
See the background-image is behind the border area.
- Try it
background-origin: border-box; content-box
-
The background image is positioned relative to the content box.
See the background-image is behind the content area only.
- Try it
background-origin: content-box;
Applicable to
It applies to all elements