Skip to content

Background Position

Utilities for applying background-position to an element.

Quick reference

ClassProperty
bg-position-bottombackground-position: bottom;
bg-position-centerbackground-position: center;
bg-position-leftbackground-position: left;
bg-position-rightbackground-position: right;
bg-position-topbackground-position: top;

Usage

Use the bg-position-{position} class for setup background position.


<div class="bg-position-top">
    <!-- ... -->
</div>

Applying conditionally

Breakpoints and media queries

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


<div class="bg-position-top lg:bg-position-bottom">
    <!-- ... -->
</div>

Customization

Extend your theme

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

@use "lasco" with (
    $extend: (
        "bg-position": (
            "left-top": "left top"
        )
    )
);

Disabled

You can easily disable the properties you don't need to use.

@use "lasco" with (
    $extend: (
        "bg-position": false
    )
);

Released under the MIT License.