Image Greyscale with CSS & re-color on mouse-over?

前端 未结 5 1328
别那么骄傲
别那么骄傲 2020-11-27 09:47

I am looking to take an icon that is colored (and will be a link) and turn it greyscale until the user places their mouse over the icon (where it would then color the image)

5条回答
  •  心在旅途
    2020-11-27 10:26

    I use the following code on http://www.diagnomics.com/

    Smooth transition from b/w to color with magnifying effect (scale)

        img.color_flip {
          filter: url(filters.svg#grayscale); /* Firefox 3.5+ */
          filter: gray; /* IE5+ */
          -webkit-filter: grayscale(1); /* Webkit Nightlies & Chrome Canary */
          -webkit-transition: all .5s ease-in-out;
        }
    
        img.color_flip:hover {
          filter: none;
          -webkit-filter: grayscale(0);
          -webkit-transform: scale(1.1);
        }
    

提交回复
热议问题