brightness()
brightness()
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.
语法
brightness(amount)
值
amount
- 输出的亮度值取决于
<number>
或<percentage>
的大小. 低于100%
的值会使图片变暗, 超过100%
的值将会使其变亮.当值为0%
时将会创建一个全黑的图像, 当值为100%
时不会有任何变化. 该值为空时默认为1
.
例子
brightness(0%) /* 全黑 */
brightness(0.4) /* 40% 亮度 */
brightness(1) /* 无效果 */
brightness(200%) /* 两倍亮度 */