Website black and white gray four kinds of code explained in detail

Time:2021-6-16

It’s a pity that the Wenchuan earthquake on May 12, 2008 took away a lot of lives. In order to express deep mourning for the victims, the State Council has decided that May 19-21, 2008 will be the national day of mourning. During this period, many websites changed their styles to “black, white and gray” to express their mourning for the victims. It is suggested that station masters all over the country move to mourn for the compatriots who died in the earthquake.

Related articles: website black and white CSS line of code.
In order to facilitate the personal webmaster to express his grief, this paper summarizes the CSS practical filter code, and makes some minor adjustments to convert the website into “black, white, gray” style.

Method 1

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

The above code can change the web page to black and white gray network, add the code to the top of CSS to achieve plain.

Method 2

If the website does not use CSS files, you can insert the following between the HTML code < head > and < / head > of the webpage / template:

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

Some webmasters’ websites may not be able to use this CSS because they do not use the latest web standard protocol. Replace the < HTML > at the top of the page with the following code:
<!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”>

Method 3

In some websites, the color of flash animation can not be controlled by CSS filter, so you can insert between < object… > and < / Object > of flash code:

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

Method 4

The simplest way to turn a page into black, white and gray is between the heads: (or the selector in CSS file is HTML or body)

<style type=”text/css”>
html {
filter: gray;
}
</style>

We deeply mourn the victims of the May 12, 2008 Wenchuan earthquake in Sichuan Province.

Method 5


<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>

The above is the website black and white gray four kinds of code detailed explanation of the detailed content, more information about the website gray please pay attention to other related articles of developer!