Browse documentation

Reference / Effects & filters

Opacity

Adjust the opacity of an element and its contents as a single painted group.

Working example

To fade only the background while text stays fully legible, use an alpha suffix on the background color.

HTML
<figure class="flex gap-2" aria-label="Ink proof at three opacities">
  <span class="size-12 bg-black opacity-25"></span>
  <span class="size-12 bg-black opacity-50"></span>
  <span class="size-12 bg-black opacity-100"></span>
</figure>

Class reference

ClassCSS declarations
opacity-0opacity: 0;
opacity-25opacity: 0.25;
opacity-50opacity: 0.5;
opacity-75opacity: 0.75;
opacity-100opacity: 1;
opacity-[.85]opacity: .85;
View full generated CSS
Compiled CSS
.opacity-0 {
  opacity: 0;
}
.opacity-100 {
  opacity: 1;
}
.opacity-25 {
  opacity: 0.25;
}
.opacity-50 {
  opacity: 0.5;
}
.opacity-75 {
  opacity: 0.75;
}
.opacity-\[\.85\] {
  opacity: .85;
}