BackgroundBackground Origin

Background Origin

Controls background positioning relative to borders, padding, and content.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari
ClassStyle
bo-bbbackground-origin: border-box;
bo-cbbackground-origin: content-box;
bo-pbbackground-origin: padding-box;

Padding Box

Initial value

The background positioning area extends to the outer edge of the padding, but does not include the border.

<div class="b-3 b-d bc-pb bo-pb bc-indigo-4 bg-indigo d-20 p-2"></div>

Border Box

The background positioning area includes the border area.

<div class="b-3 b-d bc-bb bo-bb bc-indigo-4 bg-indigo d-20 p-2"></div>

Content Box

The background positioning area is confined to the content area, excluding padding and borders.

<div class="b-3 b-d bc-cb bo-cb bc-indigo-4 bg-indigo d-20 p-2"></div>

Using utility variants

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Targeting different viewports

You can combine responsive breakpoints like sm:bo-*, md:bo-*, lg:bo-*, and xxl:bo-* to allow targeting specific utilities in different viewports.

Targeting hover states

Alternatively, you can apply :hover by using h:bo-* utility to override elements and change their values when hovering over them.