body背景图片怎么设置成灰色

html-css017

body背景图片怎么设置成灰色,第1张

在css中,可以利用background属性设置背景为灰色,只需要给元素添加“background:#c0c0c0”样式即可。在css中,可以利用opacity属性设置元素的透明度,opacity 属性设置元素的不透明级别。规定不透明度。从 0.0 (完全透明)到 1.0(完全不透明)。

下面是最大限度兼容所有浏览器的代码:

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+xmlutf8,<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.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale")

    filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)

}