Skip to content

Background Origin

Utilities for controlling background box origin.

Quick reference

ClassPropertyToken
bg-origin-borderbackground-origin: border-box;border
bg-origin-contentbackground-origin: content-box;content
bg-origin-paddingbackground-origin: padding-box;padding

Usage

Use the bg-origin-{value} class for setup background box origin.

html

<div class="bg-origin-border">
    <!-- ... -->
</div>

Applying conditionally

Breakpoints and media queries

You can also control the responsive breakpoint with variant class modifiers. For example lg:bg-origin-padding will be only apply on large screens size and above.

html

<div class="bg-origin-border lg:bg-origin-padding">
    <!-- ... -->
</div>

Customization

Extend your theme

By default, the configuration provides a handful of general purpose background box origin utilities. You can easily filter the default scales using the Sass configuration.

scss
@use "lasco" with (
    $extend: (
        "background-origin": (
            "content"
        )
    )
);

Released under the MIT License.