css濾鏡實現頁麵灰色黑白色效果代碼_經驗交流

來源:互聯網
上載者:User
淘寶的代碼

複製代碼 代碼如下:

html {
filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
-webkit-filter: grayscale(1);
}


CSS3 greyscale 濾鏡實現

如下測試代碼:
複製代碼 代碼如下:

.gray {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
}


html { filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); } 

使用方法:這段代碼可以變網頁為黑白,將代碼加到CSS最頂端就可以實現素裝。建議全國站長動起來。為在地震中遇難的同胞哀悼。

如果網站沒有使用CSS,可以在網頁/模板的HTML代碼<head>和</head> 之間插入:

<style>
html{filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);}
</style> 

有一些站長的網站可能使用這個css 不能生效,是因為網站沒有使用最新的網頁標準協議 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

請將網頁最頭部的<html>替換為以上代碼。

有一些網站FLASH動畫的顏色不能被CSS濾鏡控制,可以在FLASH代碼的<object …>和</object>之間插入: 

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

最簡單的把頁面變成灰色的代碼是在head 之間加<style type="text/css"> 

html {
FILTER: gray
}
</style> 

一般的discuz論壇在 你的控制css 檔案下修改/images/header/header.css 這個檔案 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.