在翱翔的黑白CSS背景

Joa*_*lai 6 html css

我有一个CSS精灵像:

HTML

<a id="estates" href="http://www.domain.com/estate"></a>
Run Code Online (Sandbox Code Playgroud)

CSS

#estates {background-position: -200px 0px;width: 96px;height: 90px;}

#estates {background: url("http://www.domain.com/images/sprite.png") no-repeat scroll 0% 0% transparent;float: left;margin: 22px -2px 30px 33px;}
Run Code Online (Sandbox Code Playgroud)

我希望当用户将鼠标悬停在链接上时将图像颜色更改为黑白或者如果不能发生则覆盖透明png?

Bil*_*ell 25

您可以查看CSS灰度过滤器.它符合以下方面:

#estates:hover {
  -webkit-filter: grayscale(100%);
  -moz-filter: grayscale(100%);
  -ms-filter: grayscale(100%);
  -o-filter: grayscale(100%);
  filter: grayscale(100%);
  filter: url(grayscale.svg); /* Firefox 4+ */
  filter: gray; /* IE 6-9 */;
}
Run Code Online (Sandbox Code Playgroud)

只是不要忘记添加浏览器支持所需的其他一百件内容

我找到了其他一百件东西并添加了它们.