使用 CSS 设置灰度效果

cssweb developmentfront end technology更新于 2025/2/20 12:28:17

灰度效果用于将对象的颜色转换为 256 级灰度。此滤镜中使用以下参数 −

参数 描述
Gray 将对象的颜色转换为 256 级灰度。

示例

您可以尝试运行以下代码来设置灰度效果 −

<html>
   <head>
   </head>
   <body>
      <img src = "/css/images/logo.png" alt = "CSS Logo" style = "Filter: Gray">
      <p>Text Example:</p>
      <div style = "width: 357;
         height: 50;
         font-size: 30pt;
         font-family: Arial Black;
         color: red;
         Filter: Gray">
         CSS Tutorials
      </div>
   </body>
</html>

相关文章


有用资源