使用 CSS 将透明像素转换为指定颜色,并将不透明像素变为透明

cssweb developmentfront end technology更新于 2025/2/20 3:24:17

使用蒙版效果将透明像素转换为指定颜色,并将不透明像素变为透明。

此滤镜中使用了以下参数

S.No
参数 &描述
1
Color
透明区域的颜色。

示例

您可以尝试运行以下代码来实现遮罩效果

<html>
   <head>
   </head>
   <body>
      <img src = "/css/images/logo.png"alt = "CSS Logo"style = "FILTER: Chroma(Color = #000000) Mask(Color=#00FF00)">
      <p>Text Example:</p>
      <div style = "width: 357;
         height: 50;
         font-size: 30pt;
         font-family: Arial Black;
         color: red;
         Filter: Mask(Color=#00FF00)">CSS Tutorials</div>
   </body>
</html>

相关文章


有用资源