Background Clip

Set the background image extent within an element.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari

Usage

Border Box

The background image extends to the outer edge of the border.

<div class="bw-3 bs-d bc-bb bc-indigo-8 bg-indigo w-20 h-20 p-2"></div>

Content Box

The background image clips to the content area, excluding padding & borders.

<div class="bw-3 bs-d bc-cb bc-indigo-8 bg-indigo w-20 h-20 p-2"></div>

Padding Box

The background image extends to the outer edge of the padding, excluding the border.

<div class="bw-3 bs-d bc-indigo-8 bc-pb bg-indigo w-20 h-20 p-2"></div>

Text

The background image clips to the text.

Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall.

<div class="bc-t fs-3xl fw-700 o-h px-4 py-2 br-2 c-transparent" style="background-image: linear-gradient(132deg, #413cb8 0.00%, #7a77cd 100.00%);">
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall.
</div>

Responsiveness

Use breakpoint prefixes to target different screen sizes. Styles apply from the breakpoint & up.

Target viewport sizes with breakpoint prefixes.

sm:bc-*
Small640px
md:bc-*
Medium768px
lg:bc-*
Large1024px
xxl:bc-*
Extra Large1536px

Hover State

Apply styles conditionally on hover using the h: prefix.

Add the h: prefix to apply styles only when the user hovers over the element.

Syntax:h:bc-*