Background Size

Controls the size of the background image of an element.

ClassStyle
bs-autobackground-size: auto
bs-cbackground-size: cover
bs-cobackground-size: contain

Auto

Initial value

The background image retains its original size.

<div class="d-30 rad-1">
<div class="bs-auto bp-c h-30 rad-1" style="background-image:url(/img/lighthouse.jpg)"></div>
</div>

Cover

The background image will cover the entire element.

<div class="d-30 rad-1">
<div class="bs-c bp-c h-30 rad-1" style="background-image:url(/img/lighthouse.jpg)"></div>
</div>

Contain

The background image will be scaled to fit within the element.

<div class="d-30 rad-1">
<div class="bs-co bp-c h-30 rad-1" style="background-image:url(/img/lighthouse.jpg)"></div>
</div>

Using utility variants

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

Using media queries

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

Using hover states

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