Skip to content

Background

CSS utility classes for controlling the size and repeat behavior of background images.

Class names

ClassDescription
bg-autobackground-size: auto; Renders the background image at its natural size.
bg-containbackground-size: contain; Scales the image to fit within the element.
bg-coverbackground-size: cover; Scales the image to fill the element entirely.
bg-repeatbackground-repeat: repeat; Tiles the image in both directions.
bg-repeat-xbackground-repeat: repeat-x; Tiles the image horizontally only.
bg-repeat-ybackground-repeat: repeat-y; Tiles the image vertically only.
bg-no-repeatbackground-repeat: no-repeat; Renders the image once without tiling.

Examples

Background Size

Contain


html
<div class="tile-auto-sm border bg-contain bg-no-repeat" style="background-image: url('/harmonia/logo/harmonia-square.jpg');"></div>

Cover


html
<div class="tile-auto-sm border bg-cover" style="background-image: url('/harmonia/logo/harmonia-square.jpg');"></div>

Auto


html
<div class="tile-sm border bg-auto bg-no-repeat" style="background-image: url('/harmonia/logo/harmonia-square.jpg');"></div>

Background Repeat

Repeat

html
<div class="tile-auto-md border bg-auto bg-repeat" style="background-image: url('/harmonia/logo/harmonia-square.jpg');"></div>

Repeat X


html
<div class="tile-auto-md border bg-auto bg-repeat-x" style="background-image: url('/harmonia/logo/harmonia-square.jpg');"></div>

Repeat Y


html
<div class="size-full border bg-auto bg-repeat-y" style="background-image: url('/harmonia/logo/harmonia-square.jpg');"></div>

No Repeat


html
<div class="tile-auto-sm border bg-auto bg-no-repeat" style="background-image: url('/harmonia/logo/harmonia-square.jpg');"></div>