Skip to main content Skip to docs navigation
View on GitHub

Opacity不透明度

Control the opacity of elements.控制元素的不透明度。

The opacity property sets the opacity level for an element. opacity属性设置元素的不透明度级别。The opacity level describes the transparency level, where 1 is not transparent at all, .5 is 50% visible, and 0 is completely transparent.不透明度级别描述了透明度级别,其中1根本不透明,.5为50%可见,0为完全透明。

Set the opacity of an element using .opacity-{value} utilities.使用.opacity-{value}实用程序设置元素的opacity

100%
75%
50%
25%
<div class="opacity-100">...</div>
<div class="opacity-75">...</div>
<div class="opacity-50">...</div>
<div class="opacity-25">...</div>

Utilities API实用程序API

Opacity utilities are declared in our utilities API in scss/_utilities.scss. 不透明实用程序在scss/_utilities.scss中的实用程序API中声明。Learn how to use the utilities API.了解如何使用实用程序API。

    "opacity": (
property: opacity,
values: (
0: 0,
25: .25,
50: .5,
75: .75,
100: 1,
)
),