Background Utilities

The background utilities provide a set of classes to adjust the background-attachment, background-clip, background-image, background-origin, background-position, background-repeat, and background-size properties of elements.

✏️ Note

For background-color utility classes, please refer to the color utilities.

Background Attachment

Class NamePropertyValue
.bg-attachment-scrollbackground-attachmentscroll
.bg-attachment-fixedbackground-attachmentfixed
.bg-attachment-localbackground-attachmentlocal

Background Clip

Class NamePropertyValue
.bg-clip-border-boxbackground-clipborder-box
.bg-clip-padding-boxbackground-clippadding-box
.bg-clip-content-boxbackground-clipcontent-box
.bg-clip-textbackground-cliptext
.bg-clip-border-areabackground-clipborder-area

Background Image

Class NamePropertyValue
.bg-image-nonebackground-imagenone

Background Origin

Class NamePropertyValue
.bg-origin-border-boxbackground-originborder-box
.bg-origin-padding-boxbackground-originpadding-box
.bg-origin-content-boxbackground-origincontent-box

Background Position

Class NamePropertyValue
.bg-position-topbackground-positiontop
.bg-position-rightbackground-positionright
.bg-position-bottombackground-positionbottom
.bg-position-leftbackground-positionleft
.bg-position-centerbackground-positioncenter

Background Repeat

Class NamePropertyValue
.bg-repeat-repeatbackground-repeatrepeat
.bg-repeat-repeat-xbackground-repeatrepeat-x
.bg-repeat-repeat-ybackground-repeatrepeat-y
.bg-repeat-spacebackground-repeatspace
.bg-repeat-roundbackground-repeatround
.bg-repeat-no-repeatbackground-repeatno-repeat

Background Size

Class NamePropertyValue
.bg-size-autobackground-sizeauto
.bg-size-coverbackground-sizecover
.bg-size-containbackground-sizecontain

Customization

To customize the background utilities, you can use the following variables.

VariableDescriptionDefault Value
$selector-baseBase selector for utility classes."."
$selector-prefixThe selector prefix for all utility classes.""
$selector-suffixThe selctor suffix for all utility classes.""
$selector-separatorThe selector separator for all utility classes.""
$use-importantAppends !important to generated utility declarations.true
$generate-base-utilitiesGenerates the base utility classes.true
$screen-awareEnables screen-aware utility variants.false
$theme-awareEnables theme-aware utility variants.false
$scheme-awareEnables scheme-aware utility variants.false
$state-awareEnables state-aware utility variants.false
$container-awareEnables container-aware utility variants.false
$screen-aware-selector-prefixPrefix to the screen-aware portion of utility selectors.""
$screen-aware-selector-suffixSuffix to the screen-aware portion of utility selectors.""
$screen-aware-selector-separatorSeparator inserted for screen-aware utility selectors."\\:"
$theme-aware-selector-prefixPrefix to the theme-aware portion of utility selectors.""
$theme-aware-selector-suffixSuffix to the theme-aware portion of utility selectors."-theme"
$theme-aware-selector-separatorSeparator inserted for theme-aware utility selectors."\\:"
$scheme-aware-selector-prefixPrefix to the scheme-aware portion of utility selectors.""
$scheme-aware-selector-suffixSuffix to the scheme-aware portion of utility selectors."-mode"
$scheme-aware-selector-separatorSeparator inserted for scheme-aware utility selectors."\\:"
$state-aware-selector-prefixPrefix to the state-aware portion of utility selectors.""
$state-aware-selector-suffixSuffix to the state-aware portion of utility selectors.""
$state-aware-selector-separatorSeparator inserted for state-aware utility selectors."\\:"
$container-aware-selector-prefixPrefix to the container-aware portion of utility selectors."cq\\:"
$container-aware-selector-suffixSuffix to the container-aware portion of utility selectors.""
$container-aware-selector-separatorSeparator inserted for container-aware utility selectors."\\:"
$utility-propertiesMap of utility properties.()
$utility-valuesMap of utility values.()
$utility-mapMap of utility property/value pairs.()

Responsive Variants

Generating responsive utility classes can be done by setting $screen-aware, $theme-aware, $scheme-aware, $state-aware, or $container-aware to true.

By default, no responsive utility classes are generated for background.

✏️ Note

For more information on responsive variants, refer to the Responsive utility classes documentation.