【发布时间】:2016-09-14 08:36:17
【问题描述】:
如何将 CSS3 webkit-filter grayscale 应用于除<figcaption> 标签之外的所有文章标签?以this jsfiddle 为例。
.black-white {
filter: grayscale(1);
-webkit-filter: grayscale(1);
transition: all 0.3s ease-out !important;
-webkit-transition: all 0.3s ease-out !important;
-moz-transition: all 0.3s ease-out !important;
-ms-transition: all 0.3s ease-out !important;
-o-transition: all 0.3s ease-out !important;
}
.black-white:hover {
filter: grayscale(0);
-webkit-filter: grayscale(0);
}
<article class="black-white">
<figure class="featured-image">
<a href="#">
<figcaption>
<img src="http://www.digital-lab.eu/wp-content/uploads/2016/06/logo-pietro-castro.png" alt="Logo Pietro Castro" class="project-logo" />
</figcaption>
<img src="http://www.digital-lab.eu/wp-content/uploads/2016/06/pietro-castro.jpg" alt="Pietro Castro" width="900" height="900" />
</a>
</figure>
</article>
【问题讨论】:
-
不推荐使用
all。它为浏览器提供了不必要的工作。您应该只转换实际需要的属性。 -
针对所有意图标签文章,而不是整个正文
标签: css css-transitions css-filters