网站全局变灰代码

2020-10-18 11:03 By "Powerless" 2627 0 1

【CSS方法】

    在网站需要变灰的页面head部分加入一行style

<head>
<style type="text/css">html {-webkit-filter: grayscale(100%);}</style>
</head>

以上代码适用于主流浏览器,如新版的chrom,edge等。

<head>
<style> 
    html { 
        -webkit-filter: grayscale(100%); 
        -moz-filter: grayscale(100%); 
        -ms-filter: grayscale(100%); 
        -o-filter: grayscale(100%); 
        filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);  
        _filter:none; 
    } 
</style>
</head>

    以上代码兼容绝大多数浏览器,包括QQ浏览器,360极速浏览器,IE浏览器等

    以上代码也可以全局写入css文件中,我们伟致的网站系统一般采用style.css/theme.css/app.css三种命名方式。如果写入全局,那么整个网站变灰。

    另外有部分网站还采用flash,那么以上代码就无法生效,需要修改flash部分的代码。

<param value="false" name="menu"/>
<param value="opaque" name="wmode"/>


评 论

View in WeChat

Others Discussion

  • 分布式架构之「 数据分布」
    Posted on 2019-11-14 10:00
  • PHP扩展ImageMagick安装
    Posted on 2022-11-11 11:16
  • PHP7不兼容性
    Posted on 2018-03-07 15:59
  • Redis各种数据类型的使用场景举例分析【三】
    Posted on 2018-11-22 17:00
  • 投票通过,PHP 8 确认引入 Union Types 2.0
    Posted on 2019-11-18 22:22
  • PHP设计模式 - 委托模式
    Posted on 2019-04-25 16:15
  • BASE原则
    Posted on 2020-12-17 16:42
  • 程序员年中考试题-段子版
    Posted on 2021-06-23 15:57