CSS设置网页全部变暗!

html-css015

CSS设置网页全部变暗!,第1张

是使用了一个CSS滤镜

<head>和</head>之间插入:

<style>

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

</style>

如果简单点的话只要:

<head>和</head>之间插入:

<style>

html{filter:gray}

</style>

如没有生效的话,是因为网站没有使用最新的网页标准协议,在网页最上面添加如下代码就可以了:

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

     拿走不谢!!!

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Title</title>

<style>

.horizontal-line {

position: relative

margin: 75px 0

width: 100%

height: 1px

}

.horizontal-line:before {

content: ""

position: absolute

background-image: linear-gradient(to left, #777, transparent)

left: 10%

right: 50%

height: 1px

}

.horizontal-line:after {

content: ""

position: absolute

background-image: linear-gradient(to right, #777, transparent)

left: 50%

right: 10%

height: 1px

}

</style>

</head>

<body>

<div class="horizontal-line"></div>

</body>

</html>

<style>

.bg{

width:200px

height:100px

background:url(bottom_bg.jpg)

}

a{

display: block

width:100%

height:100%

}

a:hover{

filter:alpha(opacity=80)

background:#000

opacity:0.5

}

</style>

<div class="bg"><a href="#"></a></div>

用css实现了。。。不过没有渐变效果,要做的话需要js