HTML & CSS Wiki

READ MORE

HTML & CSS Wiki

The background-origin property is used in CSS and certain HTML elements. This property determines the background positioning area (the origin of a background-image). background-origin does not apply when background-attachment is set to fixed.

Values[]

  • padding - Default value. The background position is relative to the padding. (For single boxes "0 0" is the upper left corner of the padding edge, and "100% 100%" is the lower right corner.)
  • border - The background position is relative to the border, so the image can go behind the border.
  • content - The background position is relative to the content.


HTML example:

<body style="background-image:url('Image_1.jpg'); background-origin:padding;">
Body content.
</body>


CSS example:

body {
      background-image:url("Image_1.jpg");
      background-origin:padding;
}