opacity()
The opacity()
CSS 函数在输入的图片实例上应用透明度属性,它的结果是一个 <filter-function>
.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Note: 这个函数与其他既有的opacity
属性类似,区别在于有了filters,有些浏览器会提供硬件加速以获取更好的性能表现。
语法
opacity(amount)
参数
amount
- 转化的数值,要求是一个
<number>
或一个<percentage>
(百分比)。值为0%
是完全透明的,值为100%会保留原来的效果。值在0%与100%之间效果为线性变化的,参数的最小差值为1。
Examples
opacity(0%) /* 完全透明*/
opacity(50%) /* 50% 透明 */
opacity(1) /* 无效果 */
See also
<filter-function>
- CSS
opacity
property