Background

Vue Bootstrap 5 Background

Convey meaning through background-color and add decoration with gradients.


Background color

Similar to the contextual text color classes, set the background of an element to any contextual class. Background utilities do not set color, so in some cases you’ll want to use .text-* color utilities.

.bg-primary
.bg-secondary
.bg-success
.bg-danger
.bg-warning
.bg-info
.bg-light
.bg-dark
.bg-body
.bg-white
.bg-transparent

Background gradient

By adding a .bg-gradient class, a linear gradient is added as background image to the backgrounds. This gradient starts with a semi-transparent white which fades out to the bottom.

Do you need a gradient in your custom CSS? Just add background-image: var(--mdb-gradient);.

.bg-primary.bg-gradient
.bg-secondary.bg-gradient
.bg-success.bg-gradient
.bg-danger.bg-gradient
.bg-warning.bg-gradient
.bg-info.bg-gradient
.bg-light.bg-gradient
.bg-dark.bg-gradient

Sass

Variables

Most background-color utilities are generated by our theme colors, reassigned from our generic color palette variables.

Grayscale colors are also available, but only a subset are used to generate any utilities.

Map

Theme colors are then put into a Sass map so we can loop over them to generate our utilities, component modifiers, and more.

Grayscale colors are also available as a Sass map. This map is not used to generate any utilities.

Mixins

No mixins are used to generate our background utilities, but we do have some additional mixins for other situations where you’d like to create your own gradients.

Grayscale colors are also available as a Sass map. This map is not used to generate any utilities.

Utilities API

Background utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.