Added in v5.1

Opacity

Control the opacity of elements.

The opacity property sets the opacity level for an element. The opacity level describes the transparency level, where 1 is not transparent at all, .5 is 50% visible, and 0 is completely transparent.

Set the opacity of an element using .opacity-{value} utilities.

Opacity - 图1

  1. <div class="opacity-100">...</div>
  2. <div class="opacity-75">...</div>
  3. <div class="opacity-50">...</div>
  4. <div class="opacity-25">...</div>
  5. <div class="opacity-0">...</div>

CSS

Sass utilities API

Opacity utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

scss/_utilities.scss

  1. "opacity": (
  2. property: opacity,
  3. values: (
  4. 0: 0,
  5. 25: .25,
  6. 50: .5,
  7. 75: .75,
  8. 100: 1,
  9. )
  10. ),