Generally, on national days of mourning, days of major earthquakes, and Qingming Festival, we will turn our entire website gray to express our condolences to the deceased. So here are a few methods 1. Just add the code to the body It is very simple to achieve this effect. You only need one CSS code: filter: grayscale(100%); and put it in the style of the body element. The effects we achieved ourselves: 2. Directly in the called css style file, so there is no need to change the html code. Directly on the code:
Or download the code, the above code is recommended Copy code The code is as follows:html{ -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><fecolormatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0 0 0 0 0 1 0\'></fecolormatrix></filter></svg>#grayscale"); filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); } 3. Tencent’s approach: <style> body *{ -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> Some other methods: 1. External style of web page black and white code (please use *.css file to write) html { filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); } 2. Internal style of black and white code of web page (written in the head tag) <style type="text/css"> <!-- html { filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%);} --> </style> 3. Inline black and white code of web page (write html tag, find html)
It’s just a code, collected by the editor of 123WORDPRESS.COM. It’s simple and practical, I hope it can help everyone. |
<<: Tips on disabling IE8 and IE9's compatibility view mode using HTML
>>: Vue's simple implementation process of imitating NetEase Cloud Music Player interface
This article is just to commemorate those CSS que...
One environment Install VMware Tools on CentOS 7 ...
Previously, I introduced several ways to achieve ...
To install Jenkins on CentOS 8, you need to use t...
After installing the MySQL database using the rpm...
In the previous article "Understanding UID a...
[Usage and function of mysql cursor] example: The...
Problem Description MySQL is started successfully...
TypeScript Bundling webpack integration Usually, ...
JDK download address: http://www.oracle.com/techn...
Table of contents 1. How to obtain different view...
Project scenario: 1. Upload file restrictions Fun...
Preface After this blog post was published, some ...
<br />I am very happy to participate in this...
Hello everyone, today we are going to learn about...