HTML / CSS 中的部分图像不透明

发布于 2024-12-05 06:23:01 字数 133 浏览 2 评论 0原文

我想知道是否可以仅影响图像中某种颜色的不透明度?

例如,我有一个 PNG 图像文件,上面有一个简单的绘图(笑脸),我将背景仅设置为“白色”。我想在网页上使用该图像,但我只想显示笑脸(没有白色背景)。

有办法做到这一点吗?

I want to know if it is possible to affect the opacity of only a certain color in an Image?

For example, I have a PNG image file that has a simple drawing on it (smiley face) and I set the backdrop to the color 'white' only. I want to use the image on a web page, but I want only the smiley face shown (no white backdrop).

Is there a way to do this?

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

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

发布评论

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

评论(2

难得心□动 2024-12-12 06:23:01

不是在 HTML 或 CSS 中,但您应该做的是在支持 PNG 透明度的图片编辑器中打开图像,并将图像背景设置为 transparent (或 opacity = 0)白色的。

Not in HTML or CSS but what you should do is open the image in a picture editor that supports PNG transparency and set your image background to transparent (or opacity = 0) instead of white.

夜夜流光相皎洁 2024-12-12 06:23:01

不是用CSS。处理这个问题的最好方法是给你的笑脸图像一个透明的背景。这样,每当您想要更改其颜色时,您都可以在其后面放置一个彩色元素。

Not with CSS. The best way to handle this would be to give your smiley face image a transparent background. That way, you could put a colored element behind it whenever you want to change its color.

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