🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #120

Background Origin


CSS background-origin Property

The CSS background-origin property specifies where the background image is positioned.

This property can have one of the following values:

  • padding-box - The background image starts from the top-left corner of the padding edge. This is default
  • border-box - The background image starts from the top-left corner of the border edge
  • content-box - The background image starts from the top-left corner of the content edge

Note: This property has no effect if the background-attachment property is set to "fixed".

The following example illustrates the background-origin property:

Example

  #div1 {
  border: 2px solid black;
  padding: 35px;

  background-image: url(img_flwr.gif);
  background-repeat: no-repeat;

  background-origin: padding-box;
}

#div2 {
  border: 2px solid black;

  padding: 35px;
  background-image: url(img_flwr.gif);

  background-repeat: no-repeat;
  background-origin: border-box;
}

#div3 {
  border: 2px solid
  black;
  padding: 35px;
  background-image: url(img_flwr.gif);

  background-repeat: no-repeat;
  background-origin: content-box;
}

CSS Advanced Background Properties

Property Description
background A shorthand property for setting all the background properties in one declaration
background-clip Specifies the painting area of the background
background-image Specifies one or more background images for an element
background-origin Specifies where the background image(s) is/are positioned
background-size Specifies the size of the background image(s)

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Background Origin – FAQs

Quick answers about learning Background Origin in CSS.

This free note from CodingNow 2.0 explains Background Origin in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Background Origin, is 100% free with no signup required.
With focused practice, most students grasp Background Origin in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now