Browse documentation

Reference / Backgrounds

Background color

Fill a surface with a theme color, a transparent color, or a custom shade.

Working example

A color with an alpha suffix leaves foreground text fully opaque. It mixes visually with whatever lies below the element.

HTML
<div class="grid grid-cols-2">
  <p class="bg-black p-4 text-white">Ink</p>
  <p class="bg-neutral-100 p-4 text-black">Paper</p>
</div>

Class reference

ClassCSS declarations
bg-blackbackground-color: #000;
bg-whitebackground-color: #fff;
bg-neutral-100background-color: oklch(0.95 0 0);
bg-black/10background-color: color-mix(in srgb, #000 10%, transparent);
bg-currentbackground-color: currentColor;
bg-transparentbackground-color: transparent;
bg-[#222]background-color: #222;
View full generated CSS
Compiled CSS
.bg-\[\#222\] {
  background-color: #222;
}
.bg-black {
  background-color: #000;
}
.bg-black\/10 {
  background-color: color-mix(in srgb, #000 10%, transparent);
}
.bg-current {
  background-color: currentColor;
}
.bg-neutral-100 {
  background-color: oklch(0.95 0 0);
}
.bg-transparent {
  background-color: transparent;
}
.bg-white {
  background-color: #fff;
}