简体   繁体   中英

Applying CSS grayscale property to images

I am using twitter bootstrap 3.3.1

<div class="col-lg-4 listing-box">
      <img class="img-circle" src="img/abc.png" style="width: 140px; height: 140px;"></img>
      <h2>Creative Designer</h2>
      <p>"The Contemplative" - Creative Designer</p>
      <p><a class="btn btn-danger" role="button">View details »</a></p>
</div>

I am using a grayscale effect on all the images, and I want to make the colors appear when hovering each image, so I am using the following Custom CSS properties with "image-circle" class provided by bootstrap :

.img-circle {
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(50%);
}

.listing-box:hover .img-circle {
filter: none;
-webkit-filter: grayscale(0%);
-moz-filter: grayscale(0%);
-ms-filter: grayscale(0%);
-o-filter: grayscale(0%);
}

The code is working fine on Chrome but its not working on Firefox and IE 10, although I have added -webkit-filter and -moz-filter.

What am I missing?

Firefox将于2015年1月发布,直到v35才支持filter 。IE具有自己的专有过滤器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM