首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:CSS 参考手册
TRY RUN / 在线示例
CSS 参考手册 尝试一下
CSS 参考手册 尝试一下
源代码
运行
<!DOCTYPE html> <html> <head> <style> img { -webkit-filter: grayscale(100%); /* Chrome, Safari, Opera */ filter: grayscale(100%); } </style> </head> <body> <p>图片转为黑白色:</p> <img src="https://img.s.ancii.com/tutorial/archive/attachments/cover/cover_css3.jpeg" alt="Pineapple" width="300" height="300"> <p><strong>注意:</strong> Internet Explorer 或 Safari 5.1 (及更早版本) 不支持该属性。</p> </body> </html>
运行结果