CSS 渐变不透明度(非背景)

发布于 2025-01-03 20:15:42 字数 129 浏览 5 评论 0原文

我知道如何使用 Alpha 创建渐变背景,但我想要的是让我的元素具有渐变不透明度。我正在寻找的是让我的 div 及其所有子元素都应用不透明度渐变。

有办法做到这一点吗?我只需要它在 webkit 中工作,因为它只是一个内部项目。

I know how to create gradient backgrounds with alpha, but what I want is to have my element have a gradient opacity. What I'm looking for is to have my div and all it's children have the opacity gradient applied to them.

Any way to do this? I only need it to work in webkit, as it's an in-house only project.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无人接听 2025-01-10 20:15:42

制作渐变背景,但使用 rgba 颜色。最后一个值将指定不透明度,1.0 表示完全不透明,0.0 表示完全透明。

background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(30,87,153,1)), color-stop(100%,rgba(125,185,232,0)));

上面是蓝色到透明的渐变。

Make a gradient background, but use rgba colors. The last value will specify the opacity, 1.0 for fully opaque, 0.0 for fully transparent.

background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(30,87,153,1)), color-stop(100%,rgba(125,185,232,0)));

Above is a blue to transparent gradient.

谜泪 2025-01-10 20:15:42

最简单的就是将其设为PNG。或者使用 webkit 掩码!

http://css-tricks.com/webkit-image-wipes/

The easiest thing is to make it a PNG. Or use a webkit mask!

http://css-tricks.com/webkit-image-wipes/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文