网站首页 > 基础教程 正文
是不是一晚上的时间,发现各大平台的网站页面都变成了灰色了,包括微信支付图标,那么如何让网站变成灰色呢?今天在代码中以一张简单的图片为示例。
【1】在代码中以一张简单图片为例
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title></head><body> <img src="栈出.png"></body></html><style>?
【1.2】网页效果图:
【2】在style里面添加样式代码:
<style> html { -webkit-filter: grayscale(100%); /* webkit */ -moz-filter: grayscale(100%); /*firefox*/ -ms-filter: grayscale(100%); /*ie9*/ -o-filter: grayscale(100%); /*opera*/ filter: grayscale(100%); filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); filter: gray; /*ie9- */ }</style>
【2.1】添加之后运行的页面效果图如下:
【2.3】 当然以上代码也可以添加在<html>标签里面,当作内联样式使用。
<html style="filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);-webkit-filter: grayscale(100%);">
【3】知识点:
CSS3 filter(滤镜)grayscale(%):属性将图像转换为灰度图像。值定义转换的比例。值为100%则完全转为灰度图像,值为0%图像无变化。值在0%到100%之间,则是效果的线性乘子。若未设置,值默认是0;因此:修改所有图片的颜色为黑白 (100% 灰度): -webkit-filter: grayscale(100%); /* Chrome, Safari, Opera */ filter: grayscale(100%); 以上是为了兼容不同浏览器
《完》
..
文章来源公众号:大前端学习之旅(ID:gh_eba7868fc67a)
- 上一篇: 轻松易懂,一文告诉你什么是http协议?
- 下一篇: 服务器开发程序员必须搞清HTTPS通讯之证书
猜你喜欢
- 2024-11-25 网站复制粘贴收费怎么办
- 2024-11-25 SEO前端meta标示优化
- 2024-11-25 给web页面添加甘特图,只需三条命令!
- 2024-11-25 初识meta标签与SEO——零基础自学网页制作
- 2024-11-25 彻底禁止查看网页源代码及破解
- 2024-11-25 国产化操作系统浏览器自定义协议
- 2024-11-25 Electron 进程间通信的四种方式
- 2024-11-25 PHP页面跳转
- 2024-11-25 如何实现公司各个系统之间的账号互通和SSO统一登陆
- 2024-11-25 10分钟学会用Python抓取电影排行榜
- 06-09Socioeconomic growth goals high on meetings' agenda
- 06-09Cities Along Middle Reaches of Yangtze River Agree on 63 Cooperation Items
- 06-09Scientists to make flag flutter on moon
- 06-09CBN丨Foreign-funded institutions bullish on Chinese assets
- 06-09Full Text: Joint Statement between the People's Republic of China and the French Republic on Climate Change on the occasion of the Tenth Anniversary of the Paris Agreement
- 06-092022年底总结,温暖和激励自己的文案
- 06-09百度实时推送代码解决方案(百度实时推送工具)
- 06-09PHP漏洞之跨网站请求伪造(php跨站脚本攻击)
- 最近发表
-
- Socioeconomic growth goals high on meetings' agenda
- Cities Along Middle Reaches of Yangtze River Agree on 63 Cooperation Items
- Scientists to make flag flutter on moon
- CBN丨Foreign-funded institutions bullish on Chinese assets
- Full Text: Joint Statement between the People's Republic of China and the French Republic on Climate Change on the occasion of the Tenth Anniversary of the Paris Agreement
- 2022年底总结,温暖和激励自己的文案
- 百度实时推送代码解决方案(百度实时推送工具)
- PHP漏洞之跨网站请求伪造(php跨站脚本攻击)
- ThinkPHP后台入口地址查找(thinkphp build.php)
- PHP新手如何提高代码质量(php新手如何提高代码质量的方法)
- 标签列表
-
- jsp (69)
- gitpush (78)
- gitreset (66)
- python字典 (67)
- dockercp (63)
- gitclone命令 (63)
- dockersave (62)
- linux命令大全 (65)
- pythonif (86)
- location.href (69)
- dockerexec (65)
- tail-f (79)
- queryselectorall (63)
- location.search (79)
- bootstrap教程 (74)
- deletesql (62)
- linuxgzip (68)
- 字符串连接 (73)
- html标签 (69)
- c++初始化列表 (64)
- mysqlinnodbmyisam区别 (63)
- arraylistadd (66)
- mysqldatesub函数 (63)
- window10java环境变量设置 (66)
- c++虚函数和纯虚函数的区别 (66)