Contact Us | +1 888 239-0733 (Toll free US/CA) Mon-Fri: 7:30am to 4:30pm (PST)

CSS 'background-origin' Property Explained

Est. Reading: 2 minutes
Posted: March 31, 2024

The CSS 'background-origin' property specifies the origin position of the background image(s). The origin is the initial positioning area of the background images before they are placed and sized according to background position and background size. Essentially, it determines from which part of the box model the background starts: the border box, padding box, or content box.

CSS 'background-origin' Property Examples

See the Pen CSS 'background-origin' Property by Webzstore (@webzstore) on CodePen.

The 'background-origin' property offers significant flexibility in how background images are integrated into an element's overall design, allowing for nuanced control over their positioning and presentation in relation to the box model.

Browser Support For 'background-origin' Property

FirefoxSafariChromeMicrosoft EdgeOpera
4.03.04.09.010.5

CSS Syntax of the 'background-origin' Property

background-origin: border-box | padding-box | content-box | initial | inherit;

Usage of the 'background-origin' Property

Use 'background-origin' when you need precise control over where your background images begin within an element's box. It's particularly useful in designs where the background needs to align tightly with the content, padding, or border areas, affecting how backgrounds integrate with the page's overall layout and visual hierarchy.

Property Values of the 'background-origin' Property

  • Border-box: The background image starts from the outer edge of the border. If the element has a border, the background image will be underneath it.
  • Padding-box: The background image starts from the outer edge of the padding. No background is drawn beneath the border.
  • Content-box: The background image is placed and sized based on the content area only. It does not extend under the padding or border.
  • Initial: Sets the property to its default value (padding-box for most browsers), effectively resetting any previous custom settings.
  • Inherit: Inherits the background-origin property from the element's parent, ensuring consistency within nested elements.

Ryan Parker

Ryan has been a standout in digital marketing since 2010. He's the go-to person for getting businesses noticed online, with over 300 projects under his belt—these range from helping local business owners to big online stores. As the Head of Digital Marketing at Webzstore Solutions, Ryan knows all the tricks to make companies shine on the internet. He's excellent at using the latest tech and smart strategies to get results. Ryan is all about making businesses grow and reach more people online.

chevron-down